本文整理汇总了C#中Packet.PutInt方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.PutInt方法的具体用法?C# Packet.PutInt怎么用?C# Packet.PutInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Packet
的用法示例。
在下文中一共展示了Packet.PutInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SquadUnkR
/// <summary>
/// Sends SquadUnkR to creature's client.
/// </summary>
/// <remarks>
/// I assume this is a list of missions the squad can do?
/// </remarks>
/// <param name="creature"></param>
/// <param name="num"></param>
public static void SquadUnkR(Creature creature, int num)
{
var packet = new Packet(Op.SquadUnkR, creature.EntityId);
packet.PutInt(num);
packet.PutInt(0); // count
{
// 003 [........000AD959] Int : 711001
// 004 [..............00] Byte : 0
// 005 [................] String : Girgashiy
// 006 [..............01] Byte : 1
// 007 [..............10] Byte : 16
// 008 [........001B7740] Int : 1800000
// 009 [........00011365] Int : 70501
// 010 [................] String : These mystic beings appeared near Abb Neagh Lake, terrorizing the land with god-like powers of destruction. Fanatics have declared them sent from the heavens and branded them the Girgashiy, a race of divine beings. They must be stopped before they reach a populated area. Form a squad with any brave companions you can find, and end their reign of terror.
// 011 [................] String : Girgashiy;Girgashiy will perform a high jump before a very powerful area attack. Use this opportunity to attack them with Crusader Skills.
// 012 [................] String : 20000 Experience Point4000G
// 013 [........00000000] Int : 0
// 014 [........00000000] Int : 0
// 015 [........00000000] Int : 0
// 016 [........00000000] Int : 0
// 017 [..............00] Byte : 0
}
creature.Client.Send(packet);
}
示例2: 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);
}
示例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.Contact.Id);
packet.PutString(client.Contact.FullName);
packet.PutString("");
packet.PutUInt(0x80000000);
packet.PutByte(0x10);
}
client.Send(packet);
}
示例4: EndRP
/// <summary>
/// Send EndRP to creature's client, to end RP session.
/// </summary>
/// <param name="creature"></param>
/// <param name="regionId"></param>
public static void EndRP(Creature creature, int regionId)
{
Packet packet = new Packet(Op.EndRP, MabiId.Channel);
packet.PutLong(creature.EntityId);
packet.PutInt(regionId);
creature.Client.Send(packet);
}
示例5: 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);
}
示例6: 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;
}
示例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: ChatR
/// <summary>
/// Broadcasts chat message in session.
/// </summary>
/// <param name="session"></param>
/// <param name="contactId"></param>
/// <param name="message"></param>
public static void ChatR(ChatSession session, int contactId, string message)
{
var packet = new Packet(Op.Msgr.ChatR, 0);
packet.PutLong(session.Id);
packet.PutInt(contactId);
packet.PutString(message);
session.Broadcast(packet);
}
示例9: ChatInviteR
/// <summary>
/// Notifies users about someone joining the chat.
/// </summary>
/// <param name="session"></param>
/// <param name="user"></param>
public static void ChatInviteR(ChatSession session, User user)
{
var packet = new Packet(Op.Msgr.ChatInviteR, 0);
packet.PutLong(session.Id);
packet.PutInt(user.Id);
packet.PutString(user.FullName);
packet.PutString(user.Nickname);
session.Broadcast(packet);
}
示例10: ChatBeginR
/// <summary>
/// Notifies users about friend being offline.
/// </summary>
/// <param name="user"></param>
public static void ChatBeginR(User user, long sessionId, int friendId)
{
var packet = new Packet(Op.Msgr.ChatBeginR, 0);
packet.PutLong(sessionId);
packet.PutInt(friendId);
user.Client.Send(packet);
}
示例11: FriendOffline
/// <summary>
/// Notifies users about friend being offline.
/// </summary>
/// <param name="user"></param>
public static void FriendOffline(List<User> users, User friend)
{
var packet = new Packet(Op.Msgr.FriendOffline, 0);
packet.PutInt(friend.Id);
foreach (var user in users)
user.Client.Send(packet);
}
示例12: PartyCreateUpdate
/// <summary>
/// Sent to clients when a new creature joins.
/// </summary>
/// <remarks>I'm not entirely sure of the purpose of this packet, I don't think the client would mind if you didn't send it.</remarks>
/// <param name="creature"></param>
public static void PartyCreateUpdate(Creature creature)
{
var loc = creature.GetPosition();
var packet = new Packet(Op.PartyCreateUpdate, 0);
packet.PutLong(creature.EntityId);
packet.PutInt(creature.PartyPosition);
packet.PutLong(creature.EntityId);
packet.PutString(creature.Name);
packet.PutByte(1);
packet.PutInt(creature.Region.Id);
packet.PutInt(loc.X);
packet.PutInt(loc.Y);
packet.PutByte(0);
packet.PutInt((int)((creature.Life * 100) / creature.LifeMax));
packet.PutInt((int)100);
packet.PutInt(creature.Party.Leader == creature ? 3 : 1); // I've only seen the leader with a 3 so far
packet.PutLong(0);
creature.Party.Broadcast(packet, true);
}
示例13: GuildMemberListR
/// <summary>
/// Sends GuildMemberListR to client.
/// </summary>
/// <param name="client"></param>
/// <param name="guild"></param>
public static void GuildMemberListR(MsgrClient client, Guild guild)
{
var packet = new Packet(Op.Msgr.GuildMemberListR, 0);
packet.PutByte(guild != null);
if (guild == null)
{
packet.PutLong(0);
packet.PutInt(0);
}
else
{
var members = guild.GetMembers();
packet.PutLong(guild.Id);
packet.PutInt(members.Count);
foreach (var member in members)
{
// TODO: Don't do this for every member.
var contact = (Contact)MsgrServer.Instance.Database.GetUserByCharacterId(member.CharacterId);
if (contact == null)
throw new Exception(string.Format("Contact not found for character id '0x{0:X16}'.", member.CharacterId));
var user = MsgrServer.Instance.UserManager.GetUserByCharacterId(member.CharacterId);
var status = (user == null ? ContactStatus.Offline : user.Status);
var channelName = (user == null ? "" : user.ChannelName);
packet.PutInt(contact.Id);
packet.PutByte((byte)status);
packet.PutInt((int)member.Rank);
packet.PutString(contact.FullName);
packet.PutString(channelName);
packet.PutLong(contact.LastLogin.Ticks);
}
}
client.Send(packet);
}
示例14: PartyFinishUpdate
/// <summary>
/// Sends new finish rule setting to all clients in the party
/// </summary>
/// <param name="party"></param>
public static void PartyFinishUpdate(Party party)
{
var packet = new Packet(Op.PartyFinishUpdate, 0);
packet.PutInt((int)party.Finish);
party.Broadcast(packet, true);
}
示例15: 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);
}