Пример #1
0
		/// <summary>
		/// Sends ClientIdentR to client.
		/// </summary>
		/// <param name="client"></param>
		/// <param name="success"></param>
		public static void CheckIdentR(LoginClient client, bool success)
		{
			var packet = new Packet(Op.ClientIdentR, MabiId.Login);
			packet.PutByte(success);
			packet.PutLong(DateTime.Now);

			client.Send(packet);
		}
Пример #2
0
        /// <summary>
        /// Sends Internal.ServerIdentifyR  to channel client.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="success"></param>
        public static void Internal_ServerIdentifyR(LoginClient client, bool success)
        {
            var packet = new Packet(Op.Internal.ServerIdentifyR, 0);

            packet.PutByte(success);

            client.Send(packet);
        }
Пример #3
0
        /// <summary>
        /// Sends LoginUnkR to client.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="unkByte"></param>
        public static void LoginUnkR(LoginClient client, byte unkByte)
        {
            var packet = new Packet(Op.LoginUnkR, MabiId.Login);

            packet.PutByte(unkByte);

            client.Send(packet);
        }
Пример #4
0
        /// <summary>
        /// Sends NameCheckR to client.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="result"></param>
        public static void NameCheckR(LoginClient client, NameCheckResult result)
        {
            var response = new Packet(Op.NameCheckR, MabiId.Login);

            response.PutByte(result == NameCheckResult.Okay);
            response.PutByte((byte)result);

            client.Send(response);
        }
Пример #5
0
        /// <summary>
        /// Sends RefuseGiftR to client.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="success"></param>
        public static void RefuseGiftR(LoginClient client, bool success)
        {
            var packet = new Packet(Op.RefuseGiftR, MabiId.Login);

            packet.PutByte(success);
            // ?

            client.Send(packet);
        }
Пример #6
0
        /// <summary>
        /// Sends ClientIdentR to client.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="success"></param>
        public static void CheckIdentR(LoginClient client, bool success)
        {
            var packet = new Packet(Op.ClientIdentR, MabiId.Login);

            packet.PutByte(success);
            packet.PutLong(DateTime.Now);

            client.Send(packet);
        }
Пример #7
0
		/// <summary>
		/// Sends message as response to login (LoginR).
		/// </summary>
		/// <param name="client"></param>
		/// <param name="format"></param>
		/// <param name="args"></param>
		public static void LoginR_Msg(LoginClient client, string format, params object[] args)
		{
			var packet = new Packet(Op.LoginR, MabiId.Login);
			packet.PutByte((byte)LoginResult.Message);
			packet.PutInt((int)LoginResultMessage.Custom);
			packet.PutInt(1);
			packet.PutString(format, args);

			client.Send(packet);
		}
Пример #8
0
        /// <summary>
        /// Sends AccountInfoRequestR to client, with client's account's data.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="success"></param>
        public static void AccountInfoRequestR(LoginClient client, bool success)
        {
            var packet = new Packet(Op.AccountInfoRequestR, MabiId.Login);
            packet.PutByte(success);

            if (success)
                packet.Add(client.Account);

            client.Send(packet);
        }
Пример #9
0
        /// <summary>
        /// Sends message as response to login (LoginR).
        /// </summary>
        /// <param name="client"></param>
        /// <param name="format"></param>
        /// <param name="args"></param>
        public static void LoginR_Msg(LoginClient client, string format, params object[] args)
        {
            var packet = new Packet(Op.LoginR, MabiId.Login);

            packet.PutByte((byte)LoginResult.Message);
            packet.PutInt((int)LoginResultMessage.Custom);
            packet.PutInt(1);
            packet.PutString(format, args);

            client.Send(packet);
        }
Пример #10
0
		/// <summary>
		/// Sends (negative) LoginR to client.
		/// </summary>
		/// <param name="client"></param>
		/// <param name="result"></param>
		public static void LoginR_Fail(LoginClient client, LoginResult result)
		{
			var packet = new Packet(Op.LoginR, MabiId.Login);
			packet.PutByte((byte)result);
			if (result == LoginResult.SecondaryFail)
			{
				packet.PutInt(12);
				packet.PutByte(1); // TODO: Number of fail attempts
			}

			client.Send(packet);
		}
Пример #11
0
        /// <summary>
        /// Sends negative TradeCardR to client (temp).
        /// </summary>
        /// <param name="client"></param>
        /// <param name="cardId">Negative response if 0.</param>
        public static void TradeCardR(LoginClient client, long cardId)
        {
            var packet = new Packet(Op.TradeCardR, MabiId.Login);

            packet.PutByte(cardId != 0);
            if (cardId != 0)
            {
                packet.PutLong(cardId);
            }

            client.Send(packet);
        }
Пример #12
0
        /// <summary>
        /// Sends AccountInfoRequestR to client, with client's account's data.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="success"></param>
        public static void AccountInfoRequestR(LoginClient client, bool success)
        {
            var packet = new Packet(Op.AccountInfoRequestR, MabiId.Login);

            packet.PutByte(success);

            if (success)
            {
                packet.Add(client.Account);
            }

            client.Send(packet);
        }
Пример #13
0
        /// <summary>
        /// Sends (negative) LoginR to client.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="result"></param>
        public static void LoginR_Fail(LoginClient client, LoginResult result)
        {
            var packet = new Packet(Op.LoginR, MabiId.Login);

            packet.PutByte((byte)result);
            if (result == LoginResult.SecondaryFail)
            {
                packet.PutInt(12);
                packet.PutByte(1);                 // TODO: Number of fail attempts
            }

            client.Send(packet);
        }
Пример #14
0
        /// <summary>
        /// One response to respond them all.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="op"></param>
        /// <param name="serverName"></param>
        /// <param name="id"></param>
        private static void CreateR(LoginClient client, int op, string serverName, long id)
        {
            var response = new Packet(op, MabiId.Login);

            response.PutByte(serverName != null);

            if (serverName != null)
            {
                response.PutString(serverName);
                response.PutLong(id);
            }

            client.Send(response);
        }
Пример #15
0
        /// <summary>
        /// Sends (DeleteXRequestR|RecoverXR|DeleteXR) to client.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="op">(DeleteXRequestR|RecoverXR|DeleteXR)</param>
        /// <param name="serverName">Negative response if null</param>
        /// <param name="id"></param>
        public static void DeleteR(LoginClient client, int op, string serverName, long id)
        {
            var packet = new Packet(op, MabiId.Login);

            packet.PutByte(serverName != null);

            if (serverName != null)
            {
                packet.PutString(serverName);
                packet.PutLong(id);
                packet.PutLong(0);
            }

            client.Send(packet);
        }
Пример #16
0
        /// <summary>
        /// Sends AcceptGiftR to client.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="gift">Negative response if null</param>
        public static void AcceptGiftR(LoginClient client, Gift gift)
        {
            var packet = new Packet(Op.AcceptGiftR, MabiId.Login);
            packet.PutByte(gift != null);

            if (gift != null)
            {
                packet.PutByte(gift.IsCharacter);
                packet.PutInt(0); // ?
                packet.PutInt(0); // ?
                packet.PutInt(gift.Type);
                // ?
            }

            client.Send(packet);
        }
Пример #17
0
        /// <summary>
        /// Sends AcceptGiftR to client.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="gift">Negative response if null</param>
        public static void AcceptGiftR(LoginClient client, Gift gift)
        {
            var packet = new Packet(Op.AcceptGiftR, MabiId.Login);

            packet.PutByte(gift != null);

            if (gift != null)
            {
                packet.PutByte(gift.IsCharacter);
                packet.PutInt(0);                 // ?
                packet.PutInt(0);                 // ?
                packet.PutInt(gift.Type);
                // ?
            }

            client.Send(packet);
        }
Пример #18
0
        /// <summary>
        /// Sends PetCreationOptionsRequestR to client.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="type"></param>
        /// <param name="list">No overwrite if list is null.</param>
        public static void PetCreationOptionsRequestR(LoginClient client, PetCreationOptionsListType type, List <int> list)
        {
            var packet = new Packet(Op.PetCreationOptionsRequestR, MabiId.Login);

            packet.PutByte(list != null);

            if (list != null)
            {
                packet.PutByte((byte)type);
                foreach (var race in list)
                {
                    packet.PutInt(race);
                }
                packet.PutInt(-1);                 // End of list
            }

            client.Send(packet);
        }
Пример #19
0
        /// <summary>
        /// Sends response to accept gift. Response will be negative if gift is null.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="gift"></param>
        public static void AcceptGiftResponse(LoginClient client, Gift gift)
        {
            var packet = new MabiPacket(Op.AcceptGiftR, Id.Login);
            if (gift != null)
            {
                packet.PutByte(true);
                packet.PutByte(gift.IsCharacter);
                packet.PutInt(0); // ?
                packet.PutInt(0); // ?
                packet.PutInt(gift.Type);
                // ?
            }
            else
            {
                packet.PutByte(false);
            }

            client.Send(packet);
        }
Пример #20
0
        /// <summary>
        /// Sends LoginR with request for secondary password to client.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="account"></param>
        /// <param name="sessionKey"></param>
        public static void LoginR_Secondary(LoginClient client, Account account, long sessionKey)
        {
            var packet = new Packet(Op.LoginR, MabiId.Login);

            packet.PutByte((byte)LoginResult.SecondaryReq);
            packet.PutString(account.Name);             // Official seems to send this
            packet.PutString(account.Name);             // back hashed.
            packet.PutLong(sessionKey);
            if (account.SecondaryPassword == null)
            {
                packet.PutString("FIRST");
            }
            else
            {
                packet.PutString("NOT_FIRST");
            }

            client.Send(packet);
        }
Пример #21
0
        /// <summary>
        /// Sends ChannelInfoRequestR to client.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="info">Negative response if null.</param>
        /// <param name="characterId"></param>
        public static void ChannelInfoRequestR(LoginClient client, ChannelInfo info, long characterId)
        {
            var packet = new Packet(Op.ChannelInfoRequestR, MabiId.Channel);

            packet.PutByte(info != null);

            if (info != null)
            {
                packet.PutString(info.ServerName);
                packet.PutString(info.Name);
                packet.PutShort(6);                 // Channel "Id"? (seems to be equal to channel nr)
                packet.PutString(info.Host);
                packet.PutString(info.Host);
                packet.PutShort((short)info.Port);
                packet.PutShort((short)(info.Port + 2));
                packet.PutInt(1);
                packet.PutLong(characterId);
            }

            client.Send(packet);
        }
Пример #22
0
        /// <summary>
        /// Sends positive response to login.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="account"></param>
        /// <param name="sessionKey"></param>
        /// <param name="serverList"></param>
        public static void LoginR(LoginClient client, Account account, long sessionKey, ICollection <ServerInfo> serverList)
        {
            var packet = new Packet(Op.LoginR, MabiId.Login);

            packet.PutByte((byte)LoginResult.Success);
            packet.PutString(account.Name);
            // [160XXX] Double account name
            {
                packet.PutString(account.Name);
            }
            packet.PutLong(sessionKey);
            packet.PutByte(0);

            // Servers
            // --------------------------------------------------------------
            packet.AddServerList(serverList, ServerInfoType.Client);

            // Account Info
            // --------------------------------------------------------------
            packet.Add(account);

            client.Send(packet);
        }
Пример #23
0
        /// <summary>
        /// Sends account information. Response will be negative if account is null.
        /// </summary>
        /// <param name="client"></param>
        public static void AccountInfoRequestResponse(LoginClient client, Account account)
        {
            var packet = new MabiPacket(Op.AccountInfoRequestR, Id.Login);
            if (account != null)
            {
                packet.PutByte(true);
                packet.Add(account);
            }
            else
            {
                packet.PutByte(false);
            }

            client.Send(packet);
        }
Пример #24
0
        /// <summary>
        /// Sends response to server identification from channel.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="success"></param>
        public static void ServerIdentifyResponse(LoginClient client, bool success)
        {
            var packet = new MabiPacket(Op.Internal.ServerIdentify);
            packet.PutByte(success);

            client.Send(packet);
        }
Пример #25
0
		/// <summary>
		/// Sends Internal.ServerIdentifyR  to channel client.
		/// </summary>
		/// <param name="client"></param>
		/// <param name="success"></param>
		public static void Internal_ServerIdentifyR(LoginClient client, bool success)
		{
			var packet = new Packet(Op.Internal.ServerIdentifyR, 0);
			packet.PutByte(success);

			client.Send(packet);
		}
Пример #26
0
        /// <summary>
        /// Sends positive response to login.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="account"></param>
        /// <param name="sessionKey"></param>
        /// <param name="servers"></param>
        public static void LoginR(LoginClient client, Account account, long sessionKey, List<ServerInfo> servers)
        {
            var packet = new Packet(Op.LoginR, MabiId.Login);
            packet.PutByte((byte)LoginResult.Success);
            packet.PutString(account.Name);
            // [160XXX] Double account name
            {
                packet.PutString(account.Name);
            }
            packet.PutLong(sessionKey);
            packet.PutByte(0);

            // Servers
            // --------------------------------------------------------------
            packet.PutByte((byte)servers.Count);
            foreach (var server in servers)
                packet.Add(server);

            // Account Info
            // --------------------------------------------------------------
            packet.Add(account);

            client.Send(packet);
        }
Пример #27
0
        /// <summary>
        /// Sends response to create pet.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="serverName"></param>
        /// <param name="id"></param>
        public static void CreatePetResponse(LoginClient client, string serverName, ulong id)
        {
            var response = new MabiPacket(Op.PetCreated, Id.Login);
            if (serverName != null)
            {
                response.PutByte(true);
                response.PutString(serverName);
                response.PutLong(id);
            }
            else
            {
                response.PutByte(false);
            }

            client.Send(response);
        }
Пример #28
0
        /// <summary>
        /// Sends character info. 
        /// </summary>
        /// <param name="client"></param>
        /// <param name="character"></param>
        public static void CharacterInfo(LoginClient client, uint op, Character character, IEnumerable<Item> items)
        {
            var packet = new MabiPacket(op, Id.Login);
            if (character != null)
            {
                packet.PutByte(true);
                packet.PutString(character.Server);
                packet.PutLong(character.Id);
                packet.PutByte(1);
                packet.PutString(character.Name);
                packet.PutString("");
                packet.PutString("");
                packet.PutInt(character.Race);
                packet.PutByte(character.SkinColor);
                packet.PutByte(character.Eye);
                packet.PutByte(character.EyeColor);
                packet.PutByte(character.Mouth);
                packet.PutInt(0);
                packet.PutFloat(character.Height);
                packet.PutFloat(character.Weight);
                packet.PutFloat(character.Upper);
                packet.PutFloat(character.Lower);
                packet.PutInt(0);
                packet.PutInt(0);
                packet.PutInt(0);
                packet.PutByte(0);
                packet.PutInt(0);
                packet.PutByte(0);
                packet.PutInt(character.Color1);
                packet.PutInt(character.Color2);
                packet.PutInt(character.Color3);
                packet.PutFloat(0.0f);
                packet.PutString("");
                packet.PutFloat(49.0f);
                packet.PutFloat(49.0f);
                packet.PutFloat(0.0f);
                packet.PutFloat(49.0f);
                packet.PutInt(0);
                packet.PutInt(0);
                packet.PutShort(0);
                packet.PutLong(0);
                packet.PutString("");
                packet.PutByte(0);

                packet.PutSInt(items.Count());
                foreach (var item in items)
                {
                    packet.PutLong(item.Id);
                    packet.PutBin(item.Info);
                }

                packet.PutInt(0);  // PetRemainingTime
                packet.PutLong(0); // PetLastTime
                packet.PutLong(0); // PetExpireTime
            }
            else
            {
                packet.PutByte(false);
            }

            client.Send(packet);
        }
Пример #29
0
        /// <summary>
        /// Sends xInfoRequestR to client.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="op"></param>
        /// <param name="character"></param>
        /// <param name="items"></param>
        public static void CharacterInfoRequestR(LoginClient client, int op, Character character, List <Item> items)
        {
            var packet = new Packet(op, MabiId.Login);

            packet.PutByte(character != null);

            if (character != null)
            {
                packet.PutString(character.Server);
                packet.PutLong(character.EntityId);
                packet.PutByte(1);
                packet.PutString(character.Name);
                packet.PutString("");
                packet.PutString("");
                packet.PutInt(character.Race);
                packet.PutByte(character.SkinColor);
                packet.PutShort(character.EyeType);
                packet.PutByte(character.EyeColor);
                packet.PutByte(character.MouthType);
                packet.PutUInt((uint)character.State);
                packet.PutFloat(character.Height);
                packet.PutFloat(character.Weight);
                packet.PutFloat(character.Upper);
                packet.PutFloat(character.Lower);
                packet.PutInt(0);
                packet.PutInt(0);
                packet.PutInt(0);
                packet.PutByte(0);
                packet.PutInt(0);
                packet.PutByte(0);
                packet.PutInt((int)character.Color1);
                packet.PutInt((int)character.Color2);
                packet.PutInt((int)character.Color3);
                packet.PutFloat(0.0f);
                packet.PutString("");
                packet.PutFloat(49.0f);
                packet.PutFloat(49.0f);
                packet.PutFloat(0.0f);
                packet.PutFloat(49.0f);
                // [180800, NA196 (14.10.2014)] ?
                {
                    packet.PutShort(0);
                }
                packet.PutInt(0);
                packet.PutInt(0);
                packet.PutShort(0);
                packet.PutLong(0);
                packet.PutString("");
                packet.PutByte(0);

                packet.PutInt(items.Count);
                foreach (var item in items)
                {
                    packet.PutLong(item.Id);
                    packet.PutBin(item.Info);
                }

                packet.PutInt(character.RemainingTime);
                packet.PutLong(character.LastDeSpawn);
                packet.PutLong(0);                 // PetExpireTime
            }

            client.Send(packet);
        }
Пример #30
0
        /// <summary>
        /// Sends channel information, needed to connect. Response will be
        /// negative if channel is null.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="channel"></param>
        /// <param name="characterId"></param>
        public static void EnterGameResponse(LoginClient client, MabiChannel channel, ulong characterId)
        {
            var packet = new MabiPacket(Op.ChannelInfo, Id.World);
            if (channel != null)
            {
                packet.PutByte(true);
                packet.PutString(channel.ServerName);
                packet.PutString(channel.Name);
                packet.PutShort(6); // Channel "Id"? (seems to be equal to channel nr)
                packet.PutString(channel.IP);
                packet.PutString(channel.IP);
                packet.PutShort(channel.Port);
                packet.PutShort((ushort)(channel.Port + 2));
                packet.PutInt(1);
                packet.PutLong(characterId);
            }
            else
            {
                packet.PutByte(false);
            }

            client.Send(packet);
        }
Пример #31
0
		/// <summary>
		/// Sends positive response to login.
		/// </summary>
		/// <param name="client"></param>
		/// <param name="account"></param>
		/// <param name="sessionKey"></param>
		/// <param name="serverList"></param>
		public static void LoginR(LoginClient client, Account account, long sessionKey, ICollection<ServerInfo> serverList)
		{
			var packet = new Packet(Op.LoginR, MabiId.Login);
			packet.PutByte((byte)LoginResult.Success);
			packet.PutString(account.Name);
			// [160XXX] Double account name
			{
				packet.PutString(account.Name);
			}
			packet.PutLong(sessionKey);
			packet.PutByte(0);

			// Servers
			// --------------------------------------------------------------
			packet.AddServerList(serverList, ServerInfoType.Client);

			// Account Info
			// --------------------------------------------------------------
			packet.Add(account);

			client.Send(packet);
		}
Пример #32
0
		/// <summary>
		/// Sends PetCreationOptionsRequestR to client.
		/// </summary>
		/// <param name="client"></param>
		/// <param name="type"></param>
		/// <param name="list">No overwrite if list is null.</param>
		public static void PetCreationOptionsRequestR(LoginClient client, PetCreationOptionsListType type, List<int> list)
		{
			var packet = new Packet(Op.PetCreationOptionsRequestR, MabiId.Login);
			packet.PutByte(list != null);

			if (list != null)
			{
				packet.PutByte((byte)type);
				foreach (var race in list)
					packet.PutInt(race);
				packet.PutInt(-1); // End of list
			}

			client.Send(packet);
		}
Пример #33
0
		/// <summary>
		/// Sends RefuseGiftR to client.
		/// </summary>
		/// <param name="client"></param>
		/// <param name="success"></param>
		public static void RefuseGiftR(LoginClient client, bool success)
		{
			var packet = new Packet(Op.RefuseGiftR, MabiId.Login);
			packet.PutByte(success);
			// ?

			client.Send(packet);
		}
Пример #34
0
		/// <summary>
		/// Sends negative TradeCardR to client (temp).
		/// </summary>
		/// <param name="client"></param>
		/// <param name="cardId">Negative response if 0.</param>
		public static void TradeCardR(LoginClient client, long cardId)
		{
			var packet = new Packet(Op.TradeCardR, MabiId.Login);
			packet.PutByte(cardId != 0);
			if (cardId != 0)
				packet.PutLong(cardId);

			client.Send(packet);
		}
Пример #35
0
		/// <summary>
		/// Sends LoginUnkR to client.
		/// </summary>
		/// <param name="client"></param>
		/// <param name="unkByte"></param>
		public static void LoginUnkR(LoginClient client, byte unkByte)
		{
			var packet = new Packet(Op.LoginUnkR, MabiId.Login);
			packet.PutByte(unkByte);

			client.Send(packet);
		}
Пример #36
0
        /// <summary>
        /// Sends (negative) login result.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="result"></param>
        public static void LoginResponse(LoginClient client, LoginResult result)
        {
            var packet = new MabiPacket(Op.LoginR, Id.Login);
            packet.PutByte((byte)result);
            if (result == LoginResult.SecondaryFail)
            {
                packet.PutInt(12);
                packet.PutByte(1);
            }

            client.Send(packet);
        }
Пример #37
0
		/// <summary>
		/// One response to respond them all.
		/// </summary>
		/// <param name="client"></param>
		/// <param name="op"></param>
		/// <param name="serverName"></param>
		/// <param name="id"></param>
		private static void CreateR(LoginClient client, int op, string serverName, long id)
		{
			var response = new Packet(op, MabiId.Login);
			response.PutByte(serverName != null);

			if (serverName != null)
			{
				response.PutString(serverName);
				response.PutLong(id);
			}

			client.Send(response);
		}
Пример #38
0
        /// <summary>
        /// Sends message as response to login.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="format"></param>
        /// <param name="args"></param>
        public static void LoginResponse(LoginClient client, string format, params object[] args)
        {
            var packet = new MabiPacket(Op.LoginR, Id.Login);
            packet.PutByte(51);
            packet.PutInt(14);
            packet.PutInt(1);
            packet.PutString(format, args);

            client.Send(packet);
        }
Пример #39
0
		/// <summary>
		/// Sends NameCheckR to client.
		/// </summary>
		/// <param name="client"></param>
		/// <param name="result"></param>
		public static void NameCheckR(LoginClient client, NameCheckResult result)
		{
			var response = new Packet(Op.NameCheckR, MabiId.Login);
			response.PutByte(result == NameCheckResult.Okay);
			response.PutByte((byte)result);

			client.Send(response);
		}
Пример #40
0
        /// <summary>
        /// Sends response to delete/request/recover.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="op">Is always request op + 1.</param>
        /// <param name="serverName"></param>
        /// <param name="id"></param>
        public static void DeleteResponse(LoginClient client, uint op, string serverName, ulong id)
        {
            var packet = new MabiPacket(op, Id.Login);
            if (serverName != null)
            {
                packet.PutByte(true);
                packet.PutString(serverName);
                packet.PutLong(id);
                packet.PutLong(0);
            }
            else
            {
                packet.PutByte(false);
            }

            client.Send(packet);
        }
Пример #41
0
		/// <summary>
		/// Sends xInfoRequestR to client.
		/// </summary>
		/// <param name="client"></param>
		/// <param name="op"></param>
		/// <param name="character"></param>
		/// <param name="items"></param>
		public static void CharacterInfoRequestR(LoginClient client, int op, Character character, List<Item> items)
		{
			var packet = new Packet(op, MabiId.Login);
			packet.PutByte(character != null);

			if (character != null)
			{
				packet.PutString(character.Server);
				packet.PutLong(character.EntityId);
				packet.PutByte(1);
				packet.PutString(character.Name);
				packet.PutString("");
				packet.PutString("");
				packet.PutInt(character.Race);
				packet.PutByte(character.SkinColor);
				packet.PutShort(character.EyeType);
				packet.PutByte(character.EyeColor);
				packet.PutByte(character.MouthType);
				packet.PutUInt((uint)character.State);
				packet.PutFloat(character.Height);
				packet.PutFloat(character.Weight);
				packet.PutFloat(character.Upper);
				packet.PutFloat(character.Lower);
				packet.PutInt(0);
				packet.PutInt(0);
				packet.PutInt(0);
				packet.PutByte(0);
				packet.PutInt(0);
				packet.PutByte(0);
				packet.PutInt((int)character.Color1);
				packet.PutInt((int)character.Color2);
				packet.PutInt((int)character.Color3);
				packet.PutFloat(0.0f);
				packet.PutString("");
				packet.PutFloat(49.0f);
				packet.PutFloat(49.0f);
				packet.PutFloat(0.0f);
				packet.PutFloat(49.0f);
				// [180800, NA196 (14.10.2014)] ?
				{
					packet.PutShort(0);
				}
				packet.PutInt(0);
				packet.PutInt(0);
				packet.PutShort(0);
				packet.PutLong(0);
				packet.PutString("");
				packet.PutByte(0);

				packet.PutInt(items.Count);
				foreach (var item in items)
				{
					packet.PutLong(item.Id);
					packet.PutBin(item.Info);
				}

				packet.PutInt(0);  // PetRemainingTime
				packet.PutLong(0); // PetLastTime
				packet.PutLong(0); // PetExpireTime
			}

			client.Send(packet);
		}
Пример #42
0
        /// <summary>
        /// Sends response to client identification.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="success"></param>
        /// <param name="dateTime"></param>
        public static void ClientIdentResponse(LoginClient client, bool success, DateTime dateTime)
        {
            var packet = new MabiPacket(Op.ClientIdentR, Id.Login);
            packet.PutByte(success);
            packet.PutLong(dateTime);

            client.Send(packet);
        }
Пример #43
0
		/// <summary>
		/// Sends LoginR with request for secondary password to client.
		/// </summary>
		/// <param name="client"></param>
		/// <param name="account"></param>
		/// <param name="sessionKey"></param>
		public static void LoginR_Secondary(LoginClient client, Account account, long sessionKey)
		{
			var packet = new Packet(Op.LoginR, MabiId.Login);
			packet.PutByte((byte)LoginResult.SecondaryReq);
			packet.PutString(account.Name); // Official seems to send this
			packet.PutString(account.Name); // back hashed.
			packet.PutLong(sessionKey);
			if (account.SecondaryPassword == null)
				packet.PutString("FIRST");
			else
				packet.PutString("NOT_FIRST");

			client.Send(packet);
		}
Пример #44
0
		/// <summary>
		/// Sends ChannelInfoRequestR to client.
		/// </summary>
		/// <param name="client"></param>
		/// <param name="info">Negative response if null.</param>
		/// <param name="characterId"></param>
		public static void ChannelInfoRequestR(LoginClient client, ChannelInfo info, long characterId)
		{
			var packet = new Packet(Op.ChannelInfoRequestR, MabiId.Channel);
			packet.PutByte(info != null);

			if (info != null)
			{
				packet.PutString(info.ServerName);
				packet.PutString(info.Name);
				packet.PutShort(6); // Channel "Id"? (seems to be equal to channel nr)
				packet.PutString(info.Host);
				packet.PutString(info.Host);
				packet.PutShort((short)info.Port);
				packet.PutShort((short)(info.Port + 2));
				packet.PutInt(1);
				packet.PutLong(characterId);
			}

			client.Send(packet);
		}
Пример #45
0
		/// <summary>
		/// Sends (DeleteXRequestR|RecoverXR|DeleteXR) to client.
		/// </summary>
		/// <param name="client"></param>
		/// <param name="op">(DeleteXRequestR|RecoverXR|DeleteXR)</param>
		/// <param name="serverName">Negative response if null</param>
		/// <param name="id"></param>
		public static void DeleteR(LoginClient client, int op, string serverName, long id)
		{
			var packet = new Packet(op, MabiId.Login);
			packet.PutByte(serverName != null);

			if (serverName != null)
			{
				packet.PutString(serverName);
				packet.PutLong(id);
				packet.PutLong(0);
			}

			client.Send(packet);
		}