Example #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);
		}
Example #2
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);
		}
Example #3
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);
        }
Example #4
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);
		}
Example #5
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);
        }
Example #6
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);
        }
Example #7
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);
        }
Example #8
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);
        }
Example #9
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);
		}
Example #10
0
		/// <summary>
		/// Semds CreatePetR to client.
		/// </summary>
		/// <param name="client"></param>
		/// <param name="serverName">Response is negative if null.</param>
		/// <param name="id"></param>
		public static void CreatePetR(LoginClient client, string serverName, long id)
		{
			CreateR(client, Op.CreatePetR, serverName, id);
		}
Example #11
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);
        }
Example #12
0
 /// <summary>
 /// Sends negative CreateCharacterR to client.
 /// </summary>
 /// <param name="client"></param>
 public static void CreateCharacterR_Fail(LoginClient client)
 {
     CreateCharacterR(client, null, 0);
 }
Example #13
0
		/// <summary>
		/// Sends negative ChannelInfoRequestR to client.
		/// </summary>
		/// <param name="client"></param>
		/// <param name="info"></param>
		public static void ChannelInfoRequestR_Fail(LoginClient client)
		{
			ChannelInfoRequestR(client, null, 0);
		}
Example #14
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);
		}
Example #15
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);
		}
Example #16
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);
		}
Example #17
0
        private void OnClientDisconnected(LoginClient client)
        {
            var update = false;

            lock (this.ChannelClients)
            {
                if (this.ChannelClients.Contains(client))
                {
                    this.ChannelClients.Remove(client);
                    update = true;
                }
            }

            if (update)
            {
                var channel = (client.Account != null ? this.ServerList.GetChannel(client.Account.Name) : null);
                if (channel == null)
                {
                    Log.Warning("Unregistered channel disconnected.");
                    return;
                }
                Log.Status("Channel '{0}' disconnected, switched to Maintenance.", client.Account.Name);
                channel.State = ChannelState.Maintenance;

                Send.ChannelUpdate();
            }
        }
Example #18
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);
		}
Example #19
0
 /// <summary>
 /// Sends negative ChannelInfoRequestR to client.
 /// </summary>
 /// <param name="client"></param>
 /// <param name="info"></param>
 public static void ChannelInfoRequestR_Fail(LoginClient client)
 {
     ChannelInfoRequestR(client, null, 0);
 }
Example #20
0
File: Send.cs Project: pie3467/aura
        /// <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);
        }
Example #21
0
 /// <summary>
 /// Sends negative (DeleteXRequestR|RecoverXR|DeleteXR) to client.
 /// </summary>
 /// <param name="client"></param>
 /// <param name="op">(DeleteXRequestR|RecoverXR|DeleteXR)</param>
 public static void DeleteR_Fail(LoginClient client, int op)
 {
     DeleteR(client, op, null, 0);
 }
Example #22
0
 /// <summary>
 /// Semds CreatePetR to client.
 /// </summary>
 /// <param name="client"></param>
 /// <param name="serverName">Response is negative if null.</param>
 /// <param name="id"></param>
 public static void CreatePetR(LoginClient client, string serverName, long id)
 {
     CreateR(client, Op.CreatePetR, serverName, id);
 }
Example #23
0
 /// <summary>
 /// Sends negative CreatePetR to client.
 /// </summary>
 /// <param name="client"></param>
 public static void CreatePetR_Fail(LoginClient client)
 {
     CreatePetR(client, null, 0);
 }
Example #24
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);
		}
Example #25
0
 /// <summary>
 /// Sends negative xInfoRequestR to client.
 /// </summary>
 /// <param name="client"></param>
 /// <param name="op"></param>
 public static void CharacterInfoRequestR_Fail(LoginClient client, int op)
 {
     Send.CharacterInfoRequestR(client, op, null, null);
 }
Example #26
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);
		}
Example #27
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);
		}
Example #28
0
		/// <summary>
		/// Sends negative (DeleteXRequestR|RecoverXR|DeleteXR) to client.
		/// </summary>
		/// <param name="client"></param>
		/// <param name="op">(DeleteXRequestR|RecoverXR|DeleteXR)</param>
		public static void DeleteR_Fail(LoginClient client, int op)
		{
			DeleteR(client, op, null, 0);
		}
Example #29
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);
		}
Example #30
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);
        }
Example #31
0
		/// <summary>
		/// Sends negative CreateCharacterR to client.
		/// </summary>
		/// <param name="client"></param>
		public static void CreateCharacterR_Fail(LoginClient client)
		{
			CreateCharacterR(client, null, 0);
		}
Example #32
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);
		}
Example #33
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);
        }
Example #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);
		}
Example #35
0
		/// <summary>
		/// Sends negative CreatePetR to client.
		/// </summary>
		/// <param name="client"></param>
		public static void CreatePetR_Fail(LoginClient client)
		{
			CreatePetR(client, null, 0);
		}
Example #36
0
		/// <summary>
		/// Sends negative xInfoRequestR to client.
		/// </summary>
		/// <param name="client"></param>
		/// <param name="op"></param>
		public static void CharacterInfoRequestR_Fail(LoginClient client, int op)
		{
			Send.CharacterInfoRequestR(client, op, null, null);
		}
Example #37
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);
        }