本文整理汇总了C#中PacketWriter.ToArray方法的典型用法代码示例。如果您正苦于以下问题:C# PacketWriter.ToArray方法的具体用法?C# PacketWriter.ToArray怎么用?C# PacketWriter.ToArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PacketWriter
的用法示例。
在下文中一共展示了PacketWriter.ToArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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();
}
示例2: btnSend_Click
private void btnSend_Click(object sender, EventArgs e)
{
PacketWriter w = new PacketWriter();
w.Write(username);
w.Write(GlobalProperties.Client.Username + ": " + txtMessage.Text);
client.Send(new BaseChatPacket(ChatClient.Header.PM, w.ToArray(false)).GetBytes());
txtMessage.ResetText();
}
示例3: Build
public override byte[] Build()
{
var writer = new PacketWriter();
writer.WriteUtf16(_message, 0x78F7, 0xA2);
writer.Write((UInt32) _type);
return writer.ToArray();
}
示例4: Build
public override byte[] Build()
{
var writer = new PacketWriter();
writer.Write(NewAmount);
return writer.ToArray();
}
示例5: Build
public override byte[] Build()
{
PacketWriter writer = new PacketWriter();
writer.Write(new byte[12]);
writer.WriteStruct(src.Header);
writer.WritePosition(dst);
writer.Write(new byte[2]);
return writer.ToArray();
}
示例6: Build
public override byte[] Build()
{
PacketWriter writer = new PacketWriter();
writer.WriteMagic((uint)questdefs.Length, 0x1DB0, 0xC5);
foreach (QuestDefiniton d in questdefs)
{
writer.WriteStruct(d);
}
return writer.ToArray();
}
示例7: HandlePacket
public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
{
// Set Player ID
var setPlayerId = new PacketWriter();
setPlayerId.WritePlayerHeader((uint)context.User.PlayerId);
context.SendPacket(6, 0, 0, setPlayerId.ToArray());
// Spawn Player
new CharacterSpawn().HandlePacket(context, flags, data, position, size);
}
示例8: Build
public override byte[] Build()
{
PacketWriter writer = new PacketWriter();
writer.WriteMagic((uint)questdiffs.Length, 0x292C, 0x5B);
foreach (QuestDifficulty d in questdiffs)
{
writer.WriteStruct(d);
}
return writer.ToArray();
}
示例9: Build
public override byte[] Build()
{
PacketWriter writer = new PacketWriter();
writer.WriteStruct(player);
writer.Write(-1); // Dunno what goes here
writer.WriteMagic(0x20, 0xE80C, 0xED); // 20 Things
writer.Write(new Byte[16 * 0x20]); // 16 Bytes each
return writer.ToArray();
}
示例10: Build
public override byte[] Build()
{
PacketWriter writer = new PacketWriter();
writer.Write(0x753A); // Unknown
writer.Write((int)0); // Unknown
writer.WriteStruct<QuestDefiniton>(data);
writer.WriteStruct<QuestDifficultyPacket.QuestDifficulty>(difficulty);
return writer.ToArray();
}
示例11: Build
public override byte[] Build()
{
PacketWriter writer = new PacketWriter();
// TODO: This sub/xor needs to be checked, it's more than likely wrong
// writer.WriteMagic((uint)questdiffs.Length, 0x1DB0, 0xC5);
writer.Write((int)0x294D); // Just directly write the sub/xor for now
foreach (QuestDifficulty d in questdiffs)
{
writer.WriteStruct(d);
}
return writer.ToArray();
}
示例12: Build
public override byte[] Build()
{
var writer = new PacketWriter();
// Enable flag
writer.Write((byte) 1);
// Blank out the rest (skills)
for (var i = 0; i < 1091; i++)
writer.Write((byte) 0);
return writer.ToArray();
}
示例13: Build
public override byte[] Build()
{
PacketWriter writer = new PacketWriter();
writer.WriteStruct(headerA);
writer.WriteStruct(headerB);
writer.Write((uint)0); // Padding
writer.WriteStruct(headerC);
writer.WriteStruct(headerD);
writer.Write((uint)0); // Padding
writer.WriteAscii(command, 0x5CCF, 0x15);
return writer.ToArray();
}
示例14: 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());
}
示例15: Build
public override byte[] Build()
{
PacketWriter writer = new PacketWriter();
writer.Write(questdef.questNameString);
writer.Write(0);
writer.Write((ushort)0);
writer.Write((ushort)0);
writer.Write((ushort)0);
writer.Write((ushort)1);
writer.WriteStruct(new ObjectHeader((uint)p.PlayerId, EntityType.Player));
writer.Write(0);
writer.Write((ushort)0);
writer.Write((ushort)0);
writer.Write((ushort)0);
writer.Write((ushort)0);
writer.Write(0);
writer.Write(0);
return writer.ToArray();
}