本文整理汇总了C#中Packet.PutByte方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.PutByte方法的具体用法?C# Packet.PutByte怎么用?C# Packet.PutByte使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Packet
的用法示例。
在下文中一共展示了Packet.PutByte方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadNoteR
/// <summary>
/// Sends note to client.
/// </summary>
/// <param name="client"></param>
/// <param name="note">Set to null for negative response.</param>
public static void ReadNoteR(MsgrClient client, Note note)
{
var packet = new Packet(Op.Msgr.ReadNoteR, 0);
packet.PutByte(note != null);
if (note != null)
{
packet.PutLong(note.Id);
packet.PutString(note.FromCharacterName);
packet.PutString(note.FromServer);
packet.PutLong(note.GetLongTime());
packet.PutByte(0); // Notification note? (reply disabled)
packet.PutString(note.Message);
}
client.Send(packet);
}
示例2: CreatePartyR
/// <summary>
/// Response to the party creation request, sends the client the relevant party data.
/// </summary>
/// <remarks>
/// I feel like I'm the MSDN with that summary.
/// </remarks>
/// <param name="creature"></param>
/// <param name="party">Set null for negative response.</param>
public static void CreatePartyR(Creature creature, Party party)
{
var packet = new Packet(Op.PartyCreateR, creature.EntityId);
packet.PutByte(party != null);
if (party != null)
packet.AddParty(party);
creature.Client.Send(packet);
}
示例3: DungeonInfo
/// <summary>
/// Sends DungeonInfo to creature's client.
/// </summary>
/// <param name="creature"></param>
/// <param name="dungeon"></param>
public static void DungeonInfo(Creature creature, Dungeon dungeon)
{
var packet = new Packet(Op.DungeonInfo, MabiId.Broadcast);
packet.PutLong(creature.EntityId);
packet.PutLong(dungeon.InstanceId);
packet.PutByte(1);
packet.PutString(dungeon.Name);
packet.PutInt(dungeon.ItemId);
packet.PutInt(dungeon.Seed);
packet.PutInt(dungeon.FloorPlan);
packet.PutInt(dungeon.Regions.Count);
foreach (var floor in dungeon.Regions)
packet.PutInt(floor.Id);
packet.PutString(dungeon.Options.ToString());
packet.PutInt(dungeon.Generator.Floors.Count);
foreach (var floor in dungeon.Generator.Floors)
{
var rooms = floor.GetRooms();
packet.PutInt(rooms.Count);
foreach (var room in rooms)
{
packet.PutByte((byte)room.X);
packet.PutByte((byte)room.Y);
}
}
packet.PutInt(0); // ? look at ciar info
packet.PutInt(dungeon.Generator.Floors.Count);
foreach (var floor in dungeon.Generator.Floors)
{
packet.PutUInt(0); // Floor seed or 0 apparently
packet.PutInt(0); // Somethin.
}
creature.Client.Send(packet);
}
示例4: PartyJoinR
/// <summary>
/// Sends the correct response to the client sending a party join request,
/// and success grants full party information.
/// </summary>
/// <remarks>
/// This is also sent when changing channel whilst in a party,
/// upon reaching the new channel.
/// </remarks>
/// <param name="creature"></param>
/// <param name="result"></param>
public static void PartyJoinR(Creature creature, PartyJoinResult result)
{
var packet = new Packet(Op.PartyJoinR, creature.EntityId);
packet.PutByte((byte)result);
if (result == PartyJoinResult.Success)
packet.AddParty(creature.Party);
creature.Client.Send(packet);
}
示例5: NoteListRequestR
/// <summary>
/// Sends note list to client.
/// </summary>
/// <param name="client"></param>
/// <param name="notes">Set to null for negative response.</param>
public static void NoteListRequestR(MsgrClient client, List<Note> notes)
{
var packet = new Packet(Op.Msgr.NoteListRequestR, 0);
packet.PutByte(notes != null);
if (notes != null)
{
packet.PutInt(notes.Count);
foreach (var note in notes)
{
packet.PutLong(note.Id);
packet.PutString(note.Sender);
packet.PutString(note.Message);
packet.PutLong(note.GetLongTime());
packet.PutByte(note.Read);
packet.PutByte(0); // Hidden if 1?
}
}
client.Send(packet);
}
示例6: LoginR
public static void LoginR(MsgrClient client, LoginResult result)
{
var packet = new Packet(Op.Msgr.LoginR, 0);
packet.PutInt((int)result);
if (result == LoginResult.Okay)
{
packet.PutInt(client.User.Id);
packet.PutString(client.User.FullName);
packet.PutString(client.User.Nickname);
packet.PutUInt((uint)client.User.ChatOptions);
packet.PutByte((byte)client.User.Status);
}
client.Send(packet);
}
示例7: SendRebirthEventInfo
private void SendRebirthEventInfo(Creature creature)
{
var duration = PlayTimeNeeded;
var startPlayTime = (long)creature.Vars.Perm[StartPlayTimeVar];
var pastPlayTime = TimeSpan.FromSeconds(creature.PlayTime - startPlayTime);
var packet = new Packet(Op.RebirthEventInfo, creature.EntityId);
packet.PutByte(true);
packet.PutLong(duration);
packet.PutLong(pastPlayTime);
packet.PutString(L("(Receive a Rebirth Potion at 0.00%.)"));
packet.PutString(L("Receive Potion"));
creature.Client.Send(packet);
}
示例8: LoginR
public static void LoginR(MsgrClient client, LoginResult result)
{
var packet = new Packet(Op.Msgr.LoginR, 0);
packet.PutInt((int)result);
if (result == LoginResult.Okay)
{
packet.PutInt(client.Contact.Id);
packet.PutString(client.Contact.FullName);
packet.PutString("");
packet.PutUInt(0x80000000);
packet.PutByte(0x10);
}
client.Send(packet);
}
示例9: GetTestPacket
private Packet GetTestPacket()
{
var packet = new Packet(0x01234567, 0x0123456789101112);
packet.PutByte(byte.MaxValue / 2);
packet.PutShort(short.MaxValue / 2);
packet.PutUShort(ushort.MaxValue / 2);
packet.PutInt(int.MaxValue / 2);
packet.PutUInt(uint.MaxValue / 2);
packet.PutLong(long.MaxValue / 2);
packet.PutULong(ulong.MaxValue / 2);
packet.PutFloat(float.MaxValue / 2);
packet.PutString("foobar^2");
packet.PutBin(new byte[] { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 });
return packet;
}
示例10: HandleShutDown
protected CommandResult HandleShutDown(string command, IList<string> args)
{
var players = ChannelServer.Instance.World.GetAllPlayers();
foreach(var player in players)
{
var packet = new Packet(Op.RequestClientDisconnect, MabiId.Channel);
packet.PutByte(1);
player.Client.Send(packet);
}
Log.Status("Players logged out. Disconnecting from login server.");
ChannelServer.Instance.LoginServer.Kill();
CliUtil.Exit(0, true);
return CommandResult.Okay;
}
示例11: SendNoteR
/// <summary>
/// Sends note to client.
/// </summary>
/// <param name="client"></param>
public static void SendNoteR(MsgrClient client)
{
var packet = new Packet(Op.Msgr.SendNoteR, 0);
packet.PutByte(0);
client.Send(packet);
}
示例12: PartyMemberWantedRefresh
/// <summary>
/// Updates the party title with new information, such as a change in the total party members,
/// name, type, etc.
/// </summary>
/// <param name="party"></param>
public static void PartyMemberWantedRefresh(Party party)
{
var packet = new Packet(Op.PartyWantedUpdate, party.Leader.EntityId);
packet.PutByte(party.IsOpen);
packet.PutString(party.ToString());
party.Leader.Region.Broadcast(packet, party.Leader);
}
示例13: FriendOptionChanged
/// <summary>
/// Updates user's status and nickname for all friends.
/// </summary>
/// <param name="friends"></param>
/// <param name="user"></param>
public static void FriendOptionChanged(List<User> friends, User user)
{
var packet = new Packet(Op.Msgr.FriendOptionChanged, 0);
packet.PutInt(user.Id);
packet.PutString(user.Nickname);
packet.PutByte((byte)user.Status);
foreach (var friendUser in friends)
friendUser.Client.Send(packet);
}
示例14: FriendUnblockR
/// <summary>
/// Response to FriendUnblock request.
/// </summary>
/// <param name="user"></param>
/// <param name="success"></param>
/// <param name="friendId">Only required on success.</param>
public static void FriendUnblockR(User user, bool success, int friendId)
{
var packet = new Packet(Op.Msgr.FriendUnblockR, 0);
packet.PutByte(success);
if (success)
packet.PutInt(friendId);
user.Client.Send(packet);
}
示例15: PartyWindowUpdate
/// <summary>
/// I THINK this one is for actually updating the UI element of the party (with leader controls).
/// </summary>
/// <param name="creature"></param>
/// <param name="party"></param>
public static void PartyWindowUpdate(Creature creature, Party party)
{
var packet = new Packet(Op.PartyWindowUpdate, 0);
packet.PutLong(creature.EntityId);
// TODO: Find out what these actually mean.
packet.PutByte(1);
packet.PutByte(1);
packet.PutByte(0);
packet.PutByte(0);
party.Broadcast(packet, true);
}