本文整理汇总了C#中Packet.PutString方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.PutString方法的具体用法?C# Packet.PutString怎么用?C# Packet.PutString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Packet
的用法示例。
在下文中一共展示了Packet.PutString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: 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);
}
示例4: 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);
}
示例5: RequestSecondaryLogin
/// <summary>
/// Sends RequestSecondaryLogin to creature's client, requesting
/// it to send a login packet for the given entity id.
/// </summary>
/// <param name="creature"></param>
/// <param name="entityId">Entity to log in.</param>
/// <param name="channelHost">Host of channel to log in to.</param>
/// <param name="channelPort">Port of channel to log in to.</param>
public static void RequestSecondaryLogin(Creature creature, long entityId, string channelHost, int channelPort)
{
Packet packet = new Packet(Op.RequestSecondaryLogin, MabiId.Channel);
packet.PutLong(entityId);
packet.PutString(channelHost);
packet.PutShort((short)channelPort);
creature.Client.Send(packet);
}
示例6: 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);
}
示例7: 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);
}
示例8: HandleAnnounce
protected CommandResult HandleAnnounce(string command, IList<string> args)
{
if (args.Count < 2)
return CommandResult.InvalidArgument;
var message = string.Join(" ", args);
var notice = Localization.Get("[Notice]") + " " + message.Substring(message.IndexOf(" "));
var packet = new Packet(Op.Internal.BroadcastNotice, 0);
packet.PutString(notice);
ChannelServer.Instance.LoginServer.Send(packet);
return CommandResult.Okay;
}
示例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: FriendListRequestR
/// <summary>
/// Sends friend list to client.
/// </summary>
/// <param name="client"></param>
/// <param name="friends"></param>
public static void FriendListRequestR(MsgrClient client, List<Friend> friends)
{
var packet = new Packet(Op.Msgr.FriendListRequestR, 0);
packet.PutInt(friends.Count);
foreach (var friend in friends)
{
packet.PutInt(friend.Id);
packet.PutByte((byte)friend.FriendshipStatus);
packet.PutString(friend.FullName);
packet.PutInt(friend.GroupId);
}
client.Send(packet);
}
示例11: YouGotNote
/// <summary>
/// Sends note to client.
/// </summary>
/// <param name="client"></param>
/// <param name="note"></param>
public static void YouGotNote(MsgrClient client, Note note)
{
var packet = new Packet(Op.Msgr.YouGotNote, 0);
packet.PutLong(note.Id);
packet.PutString(note.FromCharacterName);
packet.PutString(note.FromServer);
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: PartySettingUpdate
/// <summary>
/// Updates members on changes to the party settings
/// </summary>
/// <remarks>
/// Apparently they only get to know about name changes?
/// </remarks>
/// <param name="party"></param>
public static void PartySettingUpdate(Party party)
{
var packet = new Packet(Op.PartySettingUpdate, 0);
packet.PutString(party.Name);
party.Broadcast(packet, true);
}
示例15: ChatJoin
/// <summary>
/// Sends initial chat session information to user.
/// </summary>
/// <param name="user"></param>
/// <param name="session"></param>
public static void ChatJoin(User user, ChatSession session)
{
var users = session.GetUsers();
var packet = new Packet(Op.Msgr.ChatJoin, 0);
packet.PutLong(session.Id);
packet.PutInt(users.Length);
foreach (var sessionUser in users)
{
packet.PutInt(sessionUser.Id);
packet.PutString(sessionUser.FullName);
}
user.Client.Send(packet);
}