Ejemplo n.º 1
0
		private ClientInformation(PacketIn packet)
		{
            try
            {
                ProtocolVersion = packet.ReadByte();
                var claimedRemainingLength = packet.ReadUInt16();
                if (packet.RemainingLength != claimedRemainingLength)
                {
                    Log.Warn(WCell_Core.Auth_Logon_with_invalid_length, claimedRemainingLength, packet.RemainingLength);
                }

                var clientInstallationType = packet.ReadFourCC();
                _clientInstallationType = ClientTypeUtility.Lookup(clientInstallationType);

                Version = new ClientVersion(packet.ReadBytes(5));
                Architecture = packet.ReadFourCC().TrimEnd('\0');
                OS = packet.ReadFourCC().TrimEnd('\0');

                var locale = packet.ReadFourCC();
                _locale = ClientLocaleUtility.Lookup(locale);

                TimeZone = BitConverter.ToUInt32(packet.ReadBytes(4), 0);
                IPAddress = new XmlIPAddress(packet.ReadBytes(4));

                Log.Info(WCell_Core.ClientInformationFourCCs, ProtocolVersion, ClientInstallationType, Version, Architecture, OS, Locale, TimeZone, IPAddress);
            }
            catch
            {
            }
		}
Ejemplo n.º 2
0
		/// <summary>
		/// Returns the entry at the index that equals the numeric value of locale
		/// </summary>
		public static string Localize(this string[] texts, ClientLocale locale, params object[] args)
		{
			var text = texts[(int)locale];
			if (string.IsNullOrEmpty(text))
			{
				return texts.LocalizeWithDefaultLocale(args);
			}
			return text;
		}
Ejemplo n.º 3
0
		/// <summary>
		/// Returns the entry at the index that equals the numeric value of locale
		/// </summary>
		public static string Localize(this string[] texts, ClientLocale locale)
		{
			var text = texts[(int)locale];
			if (string.IsNullOrEmpty(text))
			{
				return LocalizeWithDefaultLocale(texts);
			}
			return text;
		}
Ejemplo n.º 4
0
		public static bool Lookup(string localeStr, out ClientLocale locale)
		{
			if (!LocaleMap.TryGetValue(localeStr.Substring(0, 4), out locale))
			{
				// 
				return false;
			}
			return true;
		}
Ejemplo n.º 5
0
        public void CreateAccount(string accountName, string password, string emailAddress, ClientLocale locale, ClientBoxLevel boxLevel)
        {
            if (accountName.Length < AccountManager.MinNameLength || accountName.Length > AccountManager.MaxNameLength)
                throw new ArgumentException();

            if (password.Length < AccountManager.MinPasswordLength || password.Length > AccountManager.MaxPasswordLength)
                throw new ArgumentException();

            AccountManager.Instance.CreateAccount(accountName, password, emailAddress, boxLevel, locale);
        }
Ejemplo n.º 6
0
        public void CreateAccount(string accountName, string password, string emailAddress, ClientLocale locale, ClientBoxLevel boxLevel)
        {
            if (accountName.Length < Constants.Accounts.MinNameLength || accountName.Length > Constants.Accounts.MaxNameLength)
                throw new ArgumentException("Account name has an invalid length.");

            if (password.Length < Constants.Accounts.MinPasswordLength || password.Length > Constants.Accounts.MaxPasswordLength)
                throw new ArgumentException("Password has an invalid length.");

            AccountManager.Instance.PostAsync(x => x.CreateAccount(accountName, password, emailAddress, boxLevel, locale));
        }
Ejemplo n.º 7
0
		public static string Localize(this string[] texts, ClientLocale locale)
		{
			var text = texts[(int)locale];
			if (string.IsNullOrEmpty(text))
			{
				text = texts[(int)RealmServerConfiguration.DefaultLocale];
				if (string.IsNullOrEmpty(text) && RealmServerConfiguration.DefaultLocale != ClientLocale.English)
				{
					text = texts[(int)ClientLocale.English];
				}
				if (text == null)
				{
					text = "";
				}
			}
			return text;
		}
Ejemplo n.º 8
0
		private ClientInformation(PacketIn packet)
		{
			packet.SkipBytes(1);	// 0

			try
			{
				Version = new ClientVersion(packet.ReadBytes(5));
				Architecture = packet.ReadReversedString();
				OS = packet.ReadReversedString();

				var localeStr = packet.ReadReversedPascalString(4);
				if (!ClientLocales.Lookup(localeStr, out m_Locale))
				{
					m_Locale = WCellConstants.DefaultLocale;
				}

				TimeZone = BitConverter.ToUInt32(packet.ReadBytes(4), 0);
				IPAddress = new XmlIPAddress(packet.ReadBytes(4));
			}
			catch
			{
			}
		}
Ejemplo n.º 9
0
		/// <summary>
		/// Sends the amount of experience gained to the characters combat log.
		/// </summary>
		/// <param name="target">the character to receieve the combat log message</param>
		/// <param name="message">the message to display in the characters combat log</param>
		public static void SendCombatLogExperienceMessage(IPacketReceiver target, ClientLocale locale, RealmLangKey key, params object[] args)
		{
			using (var packet = CreateCharChatMessage(ChatMsgType.CombatXPGain, ChatLanguage.Universal, EntityId.Zero, EntityId.Zero, null,
				RealmLocalizer.Instance.Translate(locale, key, args), ChatTag.None))
			{
				target.Send(packet);
			}
		}
Ejemplo n.º 10
0
 public void CreateAccount(string accountName, string password, string emailAddress, ClientLocale locale, ClientBoxLevel boxLevel)
 {
     Contract.Requires(!string.IsNullOrEmpty(accountName));
     Contract.Requires(!string.IsNullOrEmpty(password));
     Contract.Requires(!string.IsNullOrEmpty(emailAddress));
 }