本文整理汇总了C#中PacketReader.Finish方法的典型用法代码示例。如果您正苦于以下问题:C# PacketReader.Finish方法的具体用法?C# PacketReader.Finish怎么用?C# PacketReader.Finish使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PacketReader
的用法示例。
在下文中一共展示了PacketReader.Finish方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Read
/// <summary>
/// The read.
/// </summary>
/// <param name="client">
/// </param>
/// <param name="packet">
/// </param>
public void Read(Client client, byte[] packet)
{
PacketReader reader = new PacketReader(ref packet);
reader.ReadUInt16(); // Packet ID
reader.ReadUInt16(); // Data length
this.playerId = reader.ReadUInt32();
client.Server.Debug(
client, "{0} >> PrivGrpKickPlayer: PlayerID: {1}", client.Character.characterName, this.playerId);
reader.Finish();
}
示例2: Read
/// <summary>
/// The read.
/// </summary>
/// <param name="client">
/// </param>
/// <param name="packet">
/// </param>
public static void Read(Client client, byte[] packet)
{
PacketReader reader = new PacketReader(ref packet);
reader.ReadUInt16(); // Packet ID
reader.ReadUInt16(); // Data length
uint unknown = reader.ReadUInt32(); // ?
string username = reader.ReadString();
string password = reader.ReadString();
reader.Finish();
}
示例3: Read
/// <summary>
/// Read private group message
/// </summary>
/// <param name="client">
/// Client sending
/// </param>
/// <param name="packet">
/// packet data
/// </param>
public void Read(Client client, byte[] packet)
{
PacketReader reader = new PacketReader(ref packet);
reader.ReadUInt16(); // Packet ID
reader.ReadUInt16(); // Data length
this.playerid = reader.ReadUInt32();
this.message = reader.ReadString();
client.Server.Debug(
client,
"{0} >> PrivGrpMessage: PlayerId: {1} Message: {2}",
client.Character.characterName,
this.playerid,
this.message);
reader.Finish();
}
示例4: Read
/// <summary>
/// Read chat command packet
/// </summary>
/// <param name="client">
/// Client sending
/// </param>
/// <param name="packet">
/// packet data
/// </param>
public void Read(Client client, byte[] packet)
{
PacketReader reader = new PacketReader(ref packet);
reader.ReadUInt16(); // Packet ID
reader.ReadUInt16(); // Data length
reader.ReadUInt16(); // ?
this.command = reader.ReadString();
this.value = reader.ReadString();
client.Server.Debug(
client,
"{0} >> ChatCommand: Command: {1} Value: {2}",
client.Character.characterName,
this.command,
this.value);
reader.Finish();
}
示例5: Read
/// <summary>
/// Read and send back Player name lookup packet
/// </summary>
/// <param name="client">
/// Client sending
/// </param>
/// <param name="packet">
/// Packet data
/// </param>
public static void Read(Client client, byte[] packet)
{
PacketReader reader = new PacketReader(ref packet);
reader.ReadUInt16(); // packet ID
reader.ReadUInt16(); // data length
uint playerId = uint.MaxValue;
string playerName = reader.ReadString();
if (playerName == string.Empty)
{
return;
}
if (playerName == ConfigReadWrite.Instance.CurrentConfig.RelayBotNick)
{
byte[] botlookup = NameLookupResult.Create(
0x80000000,
ConfigReadWrite.Instance.CurrentConfig.RelayBotNick);
client.Send(botlookup);
client.Send(BuddyOnlineStatus.Create(0x80000000, 1, new byte[] { 0x00, 0x01, 0x00 }));
return;
}
client.Server.Debug(
client,
"{0} >> PlayerNameLookup: PlayerName: {1}",
client.Character.characterName,
playerName);
reader.Finish();
DBCharacter character = CharacterDao.GetByCharName(playerName);
if (character != null)
{
playerId = (uint)character.Id;
}
byte[] namelookup = NameLookupResult.Create(playerId, playerName);
client.Send(namelookup);
client.Send(
BuddyOnlineStatus.Create(
playerId,
(uint)OnlineDao.IsOnline((int)playerId).Online,
new byte[] { 0x00, 0x01, 0x00 }));
client.KnownClients.Add(playerId);
}
示例6: Read
/// <summary>
/// Read buddy add packet
/// </summary>
/// <param name="client">
/// Client sending
/// </param>
/// <param name="packet">
/// Packet data
/// </param>
public static void Read(Client client, byte[] packet)
{
PacketReader reader = new PacketReader(ref packet);
reader.ReadUInt16(); // Packet ID
reader.ReadUInt16(); // Data length
uint playerId = reader.ReadUInt32();
ushort unknown1 = reader.ReadUInt16();
byte unknown2 = reader.ReadByte();
client.Server.Debug(
client,
"{0} >> BuddyAdd: PlayerID {1} Unknown1: {2} Unknown2: {3}",
client.Character.characterName,
playerId,
unknown1,
unknown2);
reader.Finish();
}
示例7: Read
/// <summary>
/// Channel Data packet read
/// </summary>
/// <param name="client">
/// Client sending
/// </param>
/// <param name="packet">
/// Packet data
/// </param>
public void Read(Client client, byte[] packet)
{
PacketReader reader = new PacketReader(ref packet);
reader.ReadUInt16(); // Packet ID
reader.ReadUInt16(); // Data length
this.channelId = reader.ReadBytes(5);
this.mute = reader.ReadUInt16();
this.data = reader.ReadString();
client.Server.Debug(
client,
"{0} >> ChannelDataSet: Channel {1} {2} Mute: {3} Data: {4}",
client.Character.characterName,
this.channelId[0],
BitConverter.ToUInt32(this.channelId, 1),
this.mute,
this.data);
reader.Finish();
}
示例8: Read
/// <summary>
/// Read and process Tell message
/// </summary>
/// <param name="client">
/// Client sending
/// </param>
/// <param name="packet">
/// Packet data
/// </param>
public static void Read(Client client, byte[] packet)
{
PacketReader reader = new PacketReader(ref packet);
reader.ReadUInt16();
reader.ReadUInt16();
uint playerId = reader.ReadUInt32();
string message = reader.ReadString();
client.Server.Debug(client, "{0} >> Tell: PlayerId: {1}", client.Character.characterName, playerId);
reader.Finish();
if (client.ChatServer().ConnectedClients.ContainsKey(playerId))
{
Client tellClient = (Client)client.ChatServer().ConnectedClients[playerId];
if (!tellClient.KnownClients.Contains(client.Character.CharacterId))
{
byte[] pname = PlayerName.Create(client, client.Character.CharacterId);
tellClient.Send(pname);
tellClient.KnownClients.Add(client.Character.CharacterId);
// TODO: Check if status bytes are correct even for offline chars
client.Send(
BuddyOnlineStatus.Create(
(uint)tellClient.Character.CharacterId,
(uint)OnlineDao.IsOnline((int)tellClient.Character.CharacterId).Online,
new byte[] { 0x00, 0x01, 0x00 }));
}
byte[] pgroup = MsgPrivateGroup.Create(client.Character.CharacterId, message, string.Empty);
tellClient.Send(pgroup);
}
else
{
byte[] sysmsg = MsgSystem.Create("Player not online.");
client.Send(sysmsg);
}
}
示例9: Read
/// <summary>
/// Read Login Character packet
/// </summary>
/// <param name="client">
/// Client sending
/// </param>
/// <param name="packet">
/// packet data
/// </param>
public static void Read(Client client, byte[] packet)
{
PacketReader reader = new PacketReader(ref packet);
reader.ReadUInt16(); // Packet ID
reader.ReadUInt16(); // Data length
uint playerId = reader.ReadUInt32();
client.Server.Debug(
client,
"{0} >> LoginCharacter: PlayerID: {1}",
client.Character.characterName,
playerId);
reader.Finish();
if (client.IsBot)
{
CharacterDao.Instance.SetOnline((int)playerId);
}
DBCharacter character = CharacterDao.Instance.Get((int)playerId);
client.Character.CharacterId = playerId;
client.Character.characterName = character.Name;
client.Character.characterFirstName = character.FirstName;
client.Character.characterLastName = character.LastName;
client.ChatServer().AddClientToChannels(client);
if (client.IsBot)
{
// and give client its own name lookup
byte[] pname = PlayerName.Create(client, client.Character.CharacterId);
client.Send(pname);
// send server welcome message to client
byte[] anonv = MsgAnonymousVicinity.Create(
string.Empty,
string.Format(
client.ChatServer().MessageOfTheDay,
AssemblyInfoclass.RevisionName + " " + AssemblyInfoclass.AssemblyVersion),
string.Empty);
client.Send(anonv);
// TODO: Add Buddies List/BuddyOnlineStatus messages
foreach (ChannelBase channel in client.Channels)
{
byte[] channelJoin = ChannelJoin.Create(
channel.channelType,
channel.ChannelId,
channel.ChannelName,
channel.channelFlags,
new byte[] { 0x00, 0x00 });
client.Send(channelJoin);
}
if (!client.ChatServer().ConnectedClients.ContainsKey(client.Character.CharacterId))
{
client.ChatServer().ConnectedClients.Add(client.Character.CharacterId, client);
}
// add yourself to that list
client.KnownClients.Add(client.Character.CharacterId);
}
}
示例10: Read
/// <summary>
/// Read Channel Mode packet
/// </summary>
/// <param name="client">
/// Client sending
/// </param>
/// <param name="packet">
/// packet data
/// </param>
public void Read(Client client, byte[] packet)
{
PacketReader reader = new PacketReader(ref packet);
reader.ReadUInt16(); // Packet ID
reader.ReadUInt16(); // Data length
this.channelId = reader.ReadBytes(5);
this.arg1 = reader.ReadUInt16();
this.arg2 = reader.ReadUInt16();
this.arg3 = reader.ReadUInt16();
this.arg4 = reader.ReadUInt16();
client.Server.Debug(
client,
"{0} >> ChannelMode: Channel: {1} {2} Arg1: {3} Arg2: {4} Arg3: {5} Arg4: {6}",
client.Character.characterName,
this.channelId[0],
BitConverter.ToUInt32(this.channelId, 1),
this.arg1,
this.arg2,
this.arg3,
this.arg4);
reader.Finish();
}