Inheritance: Aura.Shared.Network.BaseClient
Beispiel #1
0
		/// <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);
		}
Beispiel #2
0
        /// <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);
        }
Beispiel #3
0
        /// <summary>
        /// Sends GuildMemberRemove to client.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="contactId"></param>
        public static void GuildMemberRemove(MsgrClient client, int contactId)
        {
            var packet = new Packet(Op.Msgr.GuildMemberRemove, 0);

            packet.PutInt(contactId);

            client.Send(packet);
        }
Beispiel #4
0
        /// <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);
        }
Beispiel #5
0
        /// <summary>
        /// Updates options on the client on success.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="success"></param>
        public static void ChangeOptionsR(MsgrClient client, bool success)
        {
            var packet = new Packet(Op.Msgr.ChangeOptionsR, 0);

            packet.PutByte(success);
            if (success)
            {
                packet.PutString(client.User.Nickname);
                packet.PutByte((byte)client.User.Status);
                packet.PutUInt((uint)client.User.ChatOptions);
            }

            client.Send(packet);
        }
Beispiel #6
0
        /// <summary>
        /// Sends GuildMemberState to client.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="guild"></param>
        /// <param name="member"></param>
        /// <param name="user"></param>
        /// <param name="status"></param>
        public static void GuildMemberState(MsgrClient client, Guild guild, GuildMember member, User user, ContactStatus status)
        {
            var packet = new Packet(Op.Msgr.GuildMemberState, 0);

            packet.PutByte(true);
            packet.PutInt(user.Id);
            packet.PutByte((byte)(status == ContactStatus.Online ? ContactStatus.Online : ContactStatus.Offline));
            packet.PutString(user.ChannelName);
            packet.PutLong(user.LastLogin.Ticks);
            packet.PutInt((int)member.Rank);
            packet.PutString(user.FullName);

            client.Send(packet);
        }
Beispiel #7
0
		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);
		}
Beispiel #8
0
        /// <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);
        }
Beispiel #9
0
		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);
		}
Beispiel #10
0
        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);
        }
Beispiel #11
0
		/// <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);
		}
Beispiel #12
0
        /// <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);
        }
Beispiel #13
0
        /// <summary>
        /// Sends group list to client.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="groups"></param>
        public static void GroupList(MsgrClient client, ICollection <Group> groups)
        {
            var packet = new Packet(Op.Msgr.GroupList, 0);

            // Custom groups + ETC
            packet.PutInt(groups.Count + 1);
            foreach (var group in groups)
            {
                packet.PutInt(group.Id);
                packet.PutString(group.Name);
            }

            // ETC (id:-1) and Blacklist (id:-4) are displayed always.
            packet.PutInt(-1);
            packet.PutString("");

            client.Send(packet);
        }
Beispiel #14
0
        /// <summary>
        /// Response to FriendInvite.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="result"></param>
        /// <param name="friend">Required for success, otherwise can be left null.</param>
        public static void FriendInviteR(MsgrClient client, FriendInviteResult result, Friend friend = null)
        {
            if (result == FriendInviteResult.Success && friend == null)
            {
                throw new ArgumentNullException("friend");
            }

            var packet = new Packet(Op.Msgr.FriendInviteR, 0);

            //packet.PutInt((int)result);
            packet.PutInt((int)result);
            if (result == FriendInviteResult.Success)
            {
                packet.PutInt(friend.Id);
                packet.PutString(friend.FullName);
                packet.PutByte((byte)friend.FriendshipStatus);
            }

            client.Send(packet);
        }
Beispiel #15
0
        /// <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);
        }
Beispiel #16
0
		/// <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);
		}
Beispiel #17
0
        /// <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);
        }
Beispiel #18
0
		/// <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);
		}
Beispiel #19
0
		/// <summary>
		/// Sends GuildMemberState to client.
		/// </summary>
		/// <param name="client"></param>
		/// <param name="guild"></param>
		/// <param name="member"></param>
		/// <param name="user"></param>
		/// <param name="status"></param>
		public static void GuildMemberState(MsgrClient client, Guild guild, GuildMember member, User user, ContactStatus status)
		{
			var packet = new Packet(Op.Msgr.GuildMemberState, 0);
			packet.PutByte(true);
			packet.PutInt(user.Id);
			packet.PutByte((byte)(status == ContactStatus.Online ? ContactStatus.Online : ContactStatus.Offline));
			packet.PutString(user.ChannelName);
			packet.PutLong(user.LastLogin.Ticks);
			packet.PutInt((int)member.Rank);
			packet.PutString(user.FullName);

			client.Send(packet);
		}
Beispiel #20
0
		/// <summary>
		/// Sends GuildMemberRemove to client.
		/// </summary>
		/// <param name="client"></param>
		/// <param name="contactId"></param>
		public static void GuildMemberRemove(MsgrClient client, int contactId)
		{
			var packet = new Packet(Op.Msgr.GuildMemberRemove, 0);
			packet.PutInt(contactId);

			client.Send(packet);
		}
Beispiel #21
0
		/// <summary>
		/// Updates options on the client on success.
		/// </summary>
		/// <param name="client"></param>
		/// <param name="success"></param>
		public static void ChangeOptionsR(MsgrClient client, bool success)
		{
			var packet = new Packet(Op.Msgr.ChangeOptionsR, 0);

			packet.PutByte(success);
			if (success)
			{
				packet.PutString(client.User.Nickname);
				packet.PutByte((byte)client.User.Status);
				packet.PutUInt((uint)client.User.ChatOptions);
			}

			client.Send(packet);
		}
Beispiel #22
0
		/// <summary>
		/// Sends group list to client.
		/// </summary>
		/// <param name="client"></param>
		/// <param name="groups"></param>
		public static void GroupList(MsgrClient client, ICollection<Group> groups)
		{
			var packet = new Packet(Op.Msgr.GroupList, 0);

			// Custom groups + ETC
			packet.PutInt(groups.Count + 1);
			foreach (var group in groups)
			{
				packet.PutInt(group.Id);
				packet.PutString(group.Name);
			}

			// ETC (id:-1) and Blacklist (id:-4) are displayed always.
			packet.PutInt(-1);
			packet.PutString("");

			client.Send(packet);
		}
Beispiel #23
0
		/// <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);
		}
Beispiel #24
0
		/// <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);
		}
Beispiel #25
0
		/// <summary>
		/// Response to FriendInvite.
		/// </summary>
		/// <param name="client"></param>
		/// <param name="result"></param>
		/// <param name="friend">Required for success, otherwise can be left null.</param>
		public static void FriendInviteR(MsgrClient client, FriendInviteResult result, Friend friend = null)
		{
			if (result == FriendInviteResult.Success && friend == null)
				throw new ArgumentNullException("friend");

			var packet = new Packet(Op.Msgr.FriendInviteR, 0);

			//packet.PutInt((int)result);
			packet.PutInt((int)result);
			if (result == FriendInviteResult.Success)
			{
				packet.PutInt(friend.Id);
				packet.PutString(friend.FullName);
				packet.PutByte((byte)friend.FriendshipStatus);
			}

			client.Send(packet);
		}