Beispiel #1
0
        public Account CreateAccount(string userName, string password, string email, ClientBoxLevel boxLevel = ClientBoxLevel.Cataclysm,
                                     ClientLocale locale = ClientLocale.English)
        {
            Contract.Requires(!string.IsNullOrEmpty(userName));
            Contract.Requires(userName.Length >= Constants.Accounts.MinNameLength);
            Contract.Requires(userName.Length <= Constants.Accounts.MaxNameLength);
            Contract.Requires(!string.IsNullOrEmpty(password));
            Contract.Requires(password.Length >= Constants.Accounts.MinPasswordLength);
            Contract.Requires(password.Length <= Constants.Accounts.MaxPasswordLength);
            Contract.Requires(!string.IsNullOrEmpty(email));
            Contract.Ensures(Contract.Result <Account>() != null);

            var pw   = CreatePassword(userName, password);
            var sha1 = pw.SHA1Password.GetBytes();

            Contract.Assume(sha1.Length == Password.SHA1Length);
            var sha256 = pw.SHA256Password.GetBytes();

            Contract.Assume(sha256.Length == Password.SHA256Length);

            var rec = new AccountRecord(userName, email, sha1, sha256, boxLevel, locale);

            rec.Create();

            var acc = new Account(rec);

            AddAccount(acc);
            return(acc);
        }
Beispiel #2
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
            {
            }
		}
Beispiel #3
0
        public override void read()
        {
            string readALl = readA();

            GameVersion = readC() + "." + readH() + "." + readH();
            GameLocale  = (ClientLocale)readC();
            loginSize   = readC();
            passSize    = readC();
            login       = readS(loginSize);

            password = EncryptPass.Get(readS(passSize));

            MacAddress = new PhysicalAddress(readB(6));

            readH();
            connection = readC();

            LocalIP = new IPAddress(readB(4));

            key             = readUQ();
            UserFileListMD5 = readS(32);
            readS(16);
            d3d9MD5  = readS(32); // C:\Windows\SysWOW64\d3d9.dll ?
            PublicIP = _client.GetIPAddress();
        }
Beispiel #4
0
        private void ReadHeader()
        {
            using (var command = _connection.CreateCommand())
            {
                command.CommandText = "SELECT key, value FROM header;";
                using (var reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        var key   = reader.GetString(0);
                        var value = reader.GetValue(1);

                        if (string.Compare(key, "clientbuild", StringComparison.InvariantCultureIgnoreCase) == 0)
                        {
                            int build;
                            if (int.TryParse(value.ToString(), out build))
                            {
                                ClientVersion.SetVersion((ClientVersionBuild)build);
                                ClientLocale.SetLocale("enUS");
                            }

                            break;
                        }
                    }

                    reader.Close();
                }
            }
        }
        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
            {
            }
        }
        private void TryReadHeader(string fileName)
        {
            // sniff may not contain build
            var lastWriteTimeUtc = File.GetLastWriteTimeUtc(fileName);

            // non tiawps
            // sqlite_sequnce (name, seq) while seq is the amount of files
            // packets table (id integer primary key autoincrement, sess_id integer/*not used*, timestamp datetime, direction integer, opcode integer, data blob)

            // tiawps
            // header table (`key` string primary key, value string)
            // packets table (id integer primary key autoincrement, timestamp datetime, direction integer, opcode integer, data blob)

            try
            {
                ReadHeader(); // might be non tiawps
            }
            catch (SQLiteException)
            {
                var build = ClientVersion.GetVersion(lastWriteTimeUtc);

                using (var command = _connection.CreateCommand())
                {
                    command.CommandText = "SELECT timestamp FROM packets limit 1";
                    var dateTime = Convert.ToDateTime(command.ExecuteScalar());
                    build = ClientVersion.GetVersion(dateTime);
                }

                ClientVersion.SetVersion((ClientVersionBuild)build);
                ClientLocale.SetLocale("enUS");
            }
        }
Beispiel #7
0
 private ClientInformation(PacketIn packet)
 {
     try
     {
         this.ProtocolVersion = packet.ReadByte();
         ushort num = packet.ReadUInt16();
         if (packet.RemainingLength != (int)num)
         {
             ClientInformation.Log.Warn(WCell_Core.Auth_Logon_with_invalid_length, (object)num,
                                        (object)packet.RemainingLength);
         }
         this._clientInstallationType = ClientTypeUtility.Lookup(packet.ReadFourCC());
         this.Version      = new ClientVersion(packet.ReadBytes(5));
         this.Architecture = packet.ReadFourCC().TrimEnd(new char[1]);
         this.OS           = packet.ReadFourCC().TrimEnd(new char[1]);
         this._locale      = ClientLocaleUtility.Lookup(packet.ReadFourCC());
         this.TimeZone     = BitConverter.ToUInt32(packet.ReadBytes(4), 0);
         this.IPAddress    = new XmlIPAddress(packet.ReadBytes(4));
         ClientInformation.Log.Info(WCell_Core.ClientInformationFourCCs, (object)this.ProtocolVersion,
                                    (object)this.ClientInstallationType, (object)this.Version, (object)this.Architecture,
                                    (object)this.OS, (object)this.Locale, (object)this.TimeZone, (object)this.IPAddress);
     }
     catch
     {
     }
 }
 private ClientInformation(PacketIn packet)
 {
     try
     {
         ProtocolVersion = packet.ReadByte();
         ushort num = packet.ReadUInt16();
         if (packet.RemainingLength != num)
         {
             Log.Warn(WCell_Core.Auth_Logon_with_invalid_length, num,
                      packet.RemainingLength);
         }
         _clientInstallationType = ClientTypeUtility.Lookup(packet.ReadFourCC());
         Version      = new ClientVersion(packet.ReadBytes(5));
         Architecture = packet.ReadFourCC().TrimEnd(new char[1]);
         OS           = packet.ReadFourCC().TrimEnd(new char[1]);
         _locale      = ClientLocaleUtility.Lookup(packet.ReadFourCC());
         TimeZone     = BitConverter.ToUInt32(packet.ReadBytes(4), 0);
         IPAddress    = new XmlIPAddress(packet.ReadBytes(4));
         Log.Info(WCell_Core.ClientInformationFourCCs, (object)ProtocolVersion,
                  (object)ClientInstallationType, (object)Version, (object)Architecture,
                  (object)OS, (object)Locale, (object)TimeZone, (object)IPAddress);
     }
     catch
     {
     }
 }
Beispiel #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);
     }
 }
Beispiel #10
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;
		}
Beispiel #11
0
		public static bool Lookup(string localeStr, out ClientLocale locale)
		{
			if (!LocaleMap.TryGetValue(localeStr.Substring(0, 4), out locale))
			{
				// 
				return false;
			}
			return true;
		}
Beispiel #12
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;
		}
Beispiel #13
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);
        }
Beispiel #14
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));
        }
Beispiel #15
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);
        }
Beispiel #16
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);
        }
Beispiel #17
0
        public string GetString(byte[] data, ClientLocale locale, int stringOffset)
        {
            var startOffset = GetInt32(data, stringOffset + (int)locale);
            var len         = 0;

            while (m_stringTable[(startOffset + len++)] != 0)
            {
            }

            return(TerrainDisplayConfig.DefaultEncoding.GetString(m_stringTable, startOffset, len - 1) ?? "");
        }
Beispiel #18
0
        public string GetString(byte[] data, ClientLocale locale, int stringOffset)
        {
            int int32 = DBCRecordConverter.GetInt32(data, (int)(stringOffset + locale));
            int num   = 0;

            do
            {
                ;
            }while (this.m_stringTable[int32 + num++] != (byte)0);
            return(WCellConstants.DefaultEncoding.GetString(this.m_stringTable, int32, num - 1) ?? "");
        }
Beispiel #19
0
        public DEDirectDebitTransactionRequest()
        {
            Transaction oTransaction = new Transaction();

            DE_DirectDebitTxType oDE_DirectDebitTxType = new DE_DirectDebitTxType();

            oDE_DirectDebitTxType.StoreId = "120995000";
            oDE_DirectDebitTxType.Type    = DE_DirectDebitTxTypeType.sale;

            DE_DirectDebitData oDE_DirectDebitData = new DE_DirectDebitData();

            oDE_DirectDebitData.ItemsElementName     = new ItemsChoiceType2[] { ItemsChoiceType2.BIC, ItemsChoiceType2.IBAN };
            oDE_DirectDebitData.Items                = new String[] { "PBNKDEFFXXX", "DE34500100600032121604" };
            oDE_DirectDebitData.MandateType          = MandateType.SINGLE;
            oDE_DirectDebitData.MandateTypeSpecified = true;
            oDE_DirectDebitData.DateOfMandate        = DateTime.Now.ToString("yyyyMMdd");

            oTransaction.Items = new Object[] { oDE_DirectDebitTxType, oDE_DirectDebitData };

            Payment oPayment = new Payment();

            oPayment.SubTotal                = 10;
            oPayment.ValueAddedTax           = 2;
            oPayment.ValueAddedTaxSpecified  = true;
            oPayment.DeliveryAmount          = 1;
            oPayment.DeliveryAmountSpecified = true;
            oPayment.ChargeTotal             = 13;
            oPayment.Currency                = "978";

            oTransaction.Payment = oPayment;

            Billing oBilling = new Billing();

            oBilling.Name     = "Name";
            oBilling.Address1 = "Address";
            oBilling.City     = "City";
            oBilling.State    = "State";
            oBilling.Zip      = "Zip";
            oBilling.Country  = "Country";

            oTransaction.Billing = oBilling;

            ClientLocale oClientLocale = new ClientLocale();

            oClientLocale.Country  = "UK";
            oClientLocale.Language = "en";

            oTransaction.ClientLocale = oClientLocale;

            DEDirectDebitTransactionOrderRequest      = new IPGApiOrderRequest();
            DEDirectDebitTransactionOrderRequest.Item = oTransaction;
        }
Beispiel #20
0
        public CreditCardTransactionRequest()
        {
            Transaction oTransaction = new Transaction();

            CreditCardTxType oCreditCardTxType = new CreditCardTxType();

            oCreditCardTxType.StoreId = "120995000";
            oCreditCardTxType.Type    = CreditCardTxTypeType.preauth;

            CreditCardData oCreditCardData = new CreditCardData();

            oCreditCardData.Brand            = CreditCardDataBrand.VISA;
            oCreditCardData.BrandSpecified   = true;
            oCreditCardData.ItemsElementName = new ItemsChoiceType[] { ItemsChoiceType.CardNumber, ItemsChoiceType.ExpMonth, ItemsChoiceType.ExpYear, ItemsChoiceType.CardCodeValue };
            oCreditCardData.Items            = new Object[] { "4035874000424977", "12", "18", "977" };

            oTransaction.Items = new Object[] { oCreditCardTxType, oCreditCardData };

            Payment oPayment = new Payment();

            oPayment.SubTotal                = 10;
            oPayment.ValueAddedTax           = 2;
            oPayment.ValueAddedTaxSpecified  = true;
            oPayment.DeliveryAmount          = 1;
            oPayment.DeliveryAmountSpecified = true;
            oPayment.ChargeTotal             = 13;
            oPayment.Currency                = "978";

            oTransaction.Payment = oPayment;

            Billing oBilling = new Billing();

            oBilling.Address1 = "Address";
            oBilling.City     = "City";
            oBilling.State    = "State";
            oBilling.Zip      = "Zip";
            oBilling.Country  = "Country";

            oTransaction.Billing = oBilling;

            ClientLocale oClientLocale = new ClientLocale();

            oClientLocale.Country  = "UK";
            oClientLocale.Language = "en";

            oTransaction.ClientLocale = oClientLocale;

            CreditCardTransactionOrderRequest      = new IPGApiOrderRequest();
            CreditCardTransactionOrderRequest.Item = oTransaction;
        }
        /// <summary>
        /// Method returns string value of ClickandBuyTxType object
        /// </summary>
        /// <param name="oClientLocale"></param>
        /// <returns>string value containing all ClickandBuyTxType values</returns>
        public static string ClientLocaleToString(this ClientLocale oClientLocale)
        {
            if (oClientLocale == null)
            {
                return("");
            }

            var items = new Dictionary <string, string>()
            {
                { "Country", oClientLocale.Country },
                { "Language", oClientLocale.Language }
            };

            return(Environment.NewLine + "ClientLocale Information : " + Environment.NewLine + items.NotNullDataToString());
        }
Beispiel #22
0
        public static void SendPageText(Character chr, PageTextEntry entry)
        {
            ClientLocale locale = chr.Locale;

            for (; entry != null; entry = entry.NextPageEntry)
            {
                using (RealmPacketOut packet =
                           new RealmPacketOut((PacketId)RealmServerOpCode.SMSG_PAGE_TEXT_QUERY_RESPONSE, 100))
                {
                    packet.Write(entry.PageId);
                    packet.Write(entry.Texts.Localize(locale));
                    packet.Write(entry.NextPageId);
                    chr.Send(packet, false);
                }
            }
        }
Beispiel #23
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;
		}
        public InitiateClearingRequest()
        {
            InitiateClearing oInitiateClearing = new InitiateClearing();

            oInitiateClearing.StoreId = "120995000";

            ClientLocale oClientLocale = new ClientLocale();

            oClientLocale.Country  = "UK";
            oClientLocale.Language = "en";

            WSIPGClient.WebReference.Action oAction = new WSIPGClient.WebReference.Action();
            oAction.Item         = oInitiateClearing;
            oAction.ClientLocale = oClientLocale;

            InitiateClearingActionRequest      = new IPGApiActionRequest();
            InitiateClearingActionRequest.Item = oAction;
        }
Beispiel #25
0
        /// <summary>
        /// Constructs a new AccountRecord object.
        ///
        /// Should be inserted into the database.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="email"></param>
        /// <param name="sha1"></param>
        /// <param name="sha256"></param>
        /// <param name="boxLevel"></param>
        /// <param name="locale"></param>
        public AccountRecord(string name, string email, byte[] sha1, byte[] sha256, ClientBoxLevel boxLevel = ClientBoxLevel.Cataclysm,
                             ClientLocale locale = ClientLocale.English)
        {
            Contract.Requires(!string.IsNullOrEmpty(name));
            Contract.Requires(name.Length >= Constants.Accounts.MinNameLength);
            Contract.Requires(name.Length <= Constants.Accounts.MaxNameLength);
            Contract.Requires(!string.IsNullOrEmpty(email));
            Contract.Requires(sha1 != null);
            Contract.Requires(sha1.Length == Password.SHA1Length);
            Contract.Requires(sha256 != null);
            Contract.Requires(sha256.Length == Password.SHA256Length);

            Name           = name;
            EmailAddress   = email;
            SHA1Password   = sha1;
            SHA256Password = sha256;
            BoxLevel       = boxLevel;
            Locale         = locale;
        }
Beispiel #26
0
        public InquiryOrderRequest()
        {
            InquiryOrder oInquiryOrder = new InquiryOrder();

            oInquiryOrder.StoreId = "120995000";
            oInquiryOrder.OrderId = "C-0cc41568-aef6-45bb-8b26-5d1d5733191d";

            ClientLocale oClientLocale = new ClientLocale();

            oClientLocale.Country  = "UK";
            oClientLocale.Language = "en";

            WSIPGClient.WebReference.Action oAction;
            oAction              = new WSIPGClient.WebReference.Action();
            oAction.Item         = oInquiryOrder;
            oAction.ClientLocale = oClientLocale;

            InquiryOrderActionRequest      = new IPGApiActionRequest();
            InquiryOrderActionRequest.Item = oAction;
        }
Beispiel #27
0
        public override void read()
        {
            this.GameVersion = ((int)this.readC()).ToString() + "." + (object)this.readH() + "." + (object)this.readH();
            this.GameLocale  = (ClientLocale)this.readC();
            this.loginSize   = (int)this.readC();
            this.passSize    = (int)this.readC();
            this.login       = this.readS(this.loginSize);
            this.passN       = this.readS(this.passSize);
            this.passEnc     = ComDiv.gen5(this.passN);
            this.MacAddress  = new PhysicalAddress(this.readB(6));
            this.readB(2);
            this.IsRealIP        = (int)this.readC();
            this.LocalIP         = ((int)this.readC()).ToString() + "." + (object)this.readC() + "." + (object)this.readC() + "." + (object)this.readC();
            this.key             = this.readUQ();
            this.UserFileListMD5 = this.readS(32);
            this.readD();
            this.d3d9MD5 = this.readS(32);
            int num = (int)this.readC();

            this.PublicIP = this._client.GetIPAddress();
        }
Beispiel #28
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
			{
			}
		}
Beispiel #29
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);
			}
		}
Beispiel #30
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));
 }
Beispiel #31
0
        /// <summary>
        /// Offers the reward of the given Quest to the given Character.
        /// When replying the Quest will be complete.
        /// </summary>
        /// <param name="questGiver">The qg.</param>
        /// <param name="qt">The quest id.</param>
        /// <param name="chr">The client.</param>
        public static void SendQuestGiverOfferReward(IEntity questGiver, QuestTemplate qt, Character chr)
        {
            ClientLocale locale = chr.Locale;

            using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_QUESTGIVER_OFFER_REWARD))
            {
                packet.Write(questGiver.EntityId);
                packet.WriteUInt(qt.Id);
                packet.WriteCString(qt.Titles.Localize(locale));
                packet.WriteCString(qt.OfferRewardTexts.Localize(locale));
                packet.WriteByte(qt.FollowupQuestId > 0U ? (byte)1 : (byte)0);
                packet.WriteUInt((uint)qt.Flags);
                packet.WriteUInt(qt.SuggestedPlayers);
                packet.Write(qt.OfferRewardEmotes.Length);
                for (uint index = 0; (long)index < (long)qt.OfferRewardEmotes.Length; ++index)
                {
                    packet.Write(qt.OfferRewardEmotes[index].Delay);
                    packet.Write((uint)qt.OfferRewardEmotes[index].Type);
                }

                packet.Write(qt.RewardChoiceItems.Length);
                for (int index = 0; index < qt.RewardChoiceItems.Length; ++index)
                {
                    packet.Write((uint)qt.RewardChoiceItems[index].ItemId);
                    packet.Write(qt.RewardChoiceItems[index].Amount);
                    ItemTemplate template = qt.RewardChoiceItems[index].Template;
                    if (template != null)
                    {
                        packet.Write(template.DisplayId);
                    }
                    else
                    {
                        packet.Write(0);
                    }
                }

                packet.Write(qt.RewardItems.Length);
                for (int index = 0; index < qt.RewardItems.Length; ++index)
                {
                    packet.Write((uint)qt.RewardItems[index].ItemId);
                    packet.Write(qt.RewardItems[index].Amount);
                    ItemTemplate template = qt.RewardItems[index].Template;
                    if (template != null)
                    {
                        packet.WriteUInt(template.DisplayId);
                    }
                    else
                    {
                        packet.Write(0);
                    }
                }

                if (chr.Level >= RealmServerConfiguration.MaxCharacterLevel)
                {
                    packet.Write(qt.MoneyAtMaxLevel);
                }
                else
                {
                    packet.Write(qt.RewMoney);
                }
                packet.Write(qt.CalcRewardXp(chr));
                packet.Write(qt.CalcRewardHonor(chr));
                packet.Write(qt.RewHonorMultiplier);
                packet.Write(8U);
                packet.Write((uint)qt.RewSpell);
                packet.Write((uint)qt.CastSpell);
                packet.Write((uint)qt.RewardTitleId);
                packet.Write(qt.RewardTalents);
                packet.Write(0);
                packet.Write(0);
                for (uint index = 0; index < 5U; ++index)
                {
                    packet.Write((uint)qt.RewardReputations[index].Faction);
                }
                for (uint index = 0; index < 5U; ++index)
                {
                    packet.Write(qt.RewardReputations[index].ValueId);
                }
                for (uint index = 0; index < 5U; ++index)
                {
                    packet.Write(qt.RewardReputations[index].Value);
                }
                chr.Client.Send(packet, false);
            }
        }
Beispiel #32
0
        /// <summary>Sends the quest giver quest detail.</summary>
        /// <param name="questGiver">The qg.</param>
        /// <param name="qt">The quest id.</param>
        /// <param name="chr">The client.</param>
        /// <param name="acceptable">if set to <c>true</c> [acceptable].</param>
        public static void SendDetails(IEntity questGiver, QuestTemplate qt, Character chr, bool acceptable)
        {
            ClientLocale locale = chr.Locale;

            using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_QUESTGIVER_QUEST_DETAILS))
            {
                packet.Write(questGiver != null ? questGiver.EntityId : EntityId.Zero);
                packet.Write(EntityId.Zero);
                packet.Write(qt.Id);
                packet.WriteCString(qt.Titles.Localize(locale));
                packet.WriteCString(qt.Details.Localize(locale));
                packet.WriteCString(qt.Instructions.Localize(locale));
                packet.Write(acceptable ? (byte)1 : (byte)0);
                packet.WriteUInt((uint)qt.Flags);
                packet.WriteUInt(qt.SuggestedPlayers);
                packet.Write((byte)0);
                if (qt.Flags.HasFlag(QuestFlags.HiddenRewards))
                {
                    packet.WriteUInt(0U);
                    packet.WriteUInt(0U);
                    packet.WriteUInt(0U);
                    packet.WriteUInt(0U);
                }
                else
                {
                    packet.Write(qt.RewardChoiceItems.Length);
                    for (uint index = 0; (long)index < (long)qt.RewardChoiceItems.Length; ++index)
                    {
                        packet.Write((uint)qt.RewardChoiceItems[index].ItemId);
                        packet.Write(qt.RewardChoiceItems[index].Amount);
                        ItemTemplate template = qt.RewardChoiceItems[index].Template;
                        if (template != null)
                        {
                            packet.Write(template.DisplayId);
                        }
                        else
                        {
                            packet.Write(0);
                        }
                    }

                    packet.Write(qt.RewardItems.Length);
                    for (uint index = 0; (long)index < (long)qt.RewardItems.Length; ++index)
                    {
                        packet.Write((uint)qt.RewardItems[index].ItemId);
                        packet.Write(qt.RewardItems[index].Amount);
                        ItemTemplate template = qt.RewardItems[index].Template;
                        if (template != null)
                        {
                            packet.Write(template.DisplayId);
                        }
                        else
                        {
                            packet.Write(0);
                        }
                    }

                    if (chr.Level >= RealmServerConfiguration.MaxCharacterLevel)
                    {
                        packet.Write(qt.MoneyAtMaxLevel);
                    }
                    else
                    {
                        packet.Write(qt.RewMoney);
                    }
                    packet.Write(qt.CalcRewardXp(chr));
                }

                packet.Write(qt.RewHonorAddition);
                packet.Write(qt.RewHonorMultiplier);
                packet.Write((uint)qt.RewSpell);
                packet.Write((uint)qt.CastSpell);
                packet.Write((uint)qt.RewardTitleId);
                packet.Write(qt.RewardTalents);
                packet.Write(0);
                packet.Write(0);
                for (uint index = 0; index < 5U; ++index)
                {
                    packet.Write((uint)qt.RewardReputations[index].Faction);
                }
                for (uint index = 0; index < 5U; ++index)
                {
                    packet.Write(qt.RewardReputations[index].ValueId);
                }
                for (uint index = 0; index < 5U; ++index)
                {
                    packet.Write(qt.RewardReputations[index].Value);
                }
                packet.Write(4);
                for (int index = 0; index < 4; ++index)
                {
                    EmoteTemplate questDetailedEmote = qt.QuestDetailedEmotes[index];
                    packet.Write((int)questDetailedEmote.Type);
                    packet.Write(questDetailedEmote.Delay);
                }

                chr.Client.Send(packet, false);
            }
        }
Beispiel #33
0
        /// <summary>Sends the quest query response.</summary>
        /// <param name="qt">The quest id.</param>
        /// <param name="chr">The client.</param>
        public static void SendQuestQueryResponse(QuestTemplate qt, Character chr)
        {
            ClientLocale locale = chr.Client.Info.Locale;

            using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_QUEST_QUERY_RESPONSE))
            {
                packet.Write(qt.Id);
                packet.Write((uint)qt.IsActive);
                packet.Write(qt.Level);
                packet.Write(qt.MinLevel);
                packet.Write(qt.Category);
                packet.Write((uint)qt.QuestType);
                packet.Write(qt.SuggestedPlayers);
                packet.Write((uint)qt.ObjectiveMinReputation.ReputationIndex);
                packet.Write(qt.ObjectiveMinReputation.Value);
                packet.Write((uint)qt.ObjectiveMaxReputation.ReputationIndex);
                packet.Write(qt.ObjectiveMaxReputation.Value);
                packet.Write(qt.FollowupQuestId);
                packet.Write(qt.CalcRewardXp(chr));
                if (qt.Flags.HasFlag(QuestFlags.HiddenRewards))
                {
                    packet.Write(0);
                }
                else
                {
                    packet.Write(qt.RewMoney);
                }
                packet.Write(qt.MoneyAtMaxLevel);
                packet.Write((uint)qt.CastSpell);
                packet.Write((uint)qt.RewSpell);
                packet.Write(qt.RewHonorAddition);
                packet.WriteFloat(qt.RewHonorMultiplier);
                packet.Write((uint)qt.SrcItemId);
                packet.Write((uint)qt.Flags);
                packet.Write((uint)qt.RewardTitleId);
                packet.Write(qt.PlayersSlain);
                packet.Write(qt.RewardTalents);
                packet.Write(0);
                packet.Write(0);
                if (qt.Flags.HasFlag(QuestFlags.HiddenRewards))
                {
                    for (int index = 0; index < 4; ++index)
                    {
                        packet.WriteUInt(0U);
                        packet.WriteUInt(0U);
                    }

                    for (int index = 0; index < 6; ++index)
                    {
                        packet.WriteUInt(0U);
                        packet.WriteUInt(0U);
                    }
                }
                else
                {
                    for (int index = 0; index < 4; ++index)
                    {
                        if (index < qt.RewardItems.Length)
                        {
                            packet.Write((uint)qt.RewardItems[index].ItemId);
                            packet.Write(qt.RewardItems[index].Amount);
                        }
                        else
                        {
                            packet.WriteUInt(0U);
                            packet.WriteUInt(0U);
                        }
                    }

                    for (int index = 0; index < 6; ++index)
                    {
                        if (index < qt.RewardChoiceItems.Length)
                        {
                            packet.Write((uint)qt.RewardChoiceItems[index].ItemId);
                            packet.Write(qt.RewardChoiceItems[index].Amount);
                        }
                        else
                        {
                            packet.WriteUInt(0U);
                            packet.WriteUInt(0U);
                        }
                    }
                }

                for (int index = 0; index < 5; ++index)
                {
                    packet.Write((uint)qt.RewardReputations[index].Faction);
                }
                for (int index = 0; index < 5; ++index)
                {
                    packet.Write(qt.RewardReputations[index].ValueId);
                }
                for (int index = 0; index < 5; ++index)
                {
                    packet.Write(qt.RewardReputations[index].Value);
                }
                packet.Write((uint)qt.MapId);
                packet.Write(qt.PointX);
                packet.Write(qt.PointY);
                packet.Write(qt.PointOpt);
                packet.WriteCString(qt.Titles.Localize(locale));
                packet.WriteCString(qt.Instructions.Localize(locale));
                packet.WriteCString(qt.Details.Localize(locale));
                packet.WriteCString(qt.EndTexts.Localize(locale));
                packet.WriteCString(qt.CompletedTexts.Localize(locale));
                for (int index = 0; index < 4; ++index)
                {
                    packet.Write(qt.ObjectOrSpellInteractions[index].RawId);
                    packet.Write(qt.ObjectOrSpellInteractions[index].Amount);
                    packet.Write((uint)qt.CollectableSourceItems[index].ItemId);
                    packet.Write(qt.CollectableSourceItems[index].Amount);
                }

                for (int index = 0; index < 6; ++index)
                {
                    if (index < qt.CollectableItems.Length)
                    {
                        packet.Write((uint)qt.CollectableItems[index].ItemId);
                        packet.Write(qt.CollectableItems[index].Amount);
                    }
                    else
                    {
                        packet.WriteUInt(0U);
                        packet.WriteUInt(0U);
                    }
                }

                for (int index = 0; index < 4; ++index)
                {
                    QuestObjectiveSet objectiveText = qt.ObjectiveTexts[(int)locale];
                    if (objectiveText != null)
                    {
                        packet.Write(objectiveText.Texts[index]);
                    }
                    else
                    {
                        packet.Write("");
                    }
                }

                chr.Client.Send(packet, false);
            }
        }
Beispiel #34
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));
 }
Beispiel #35
0
 public string Translate(ClientLocale locale)
 {
     return(RealmLocalizer.Instance.Translate(locale, this));
 }
Beispiel #36
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));
        }
Beispiel #37
0
 static void SetLocale(string locale)
 {
     ClientLocale.SetLocale(locale);
 }
Beispiel #38
0
        public static void SendItemQueryResponse(IRealmClient client, ItemTemplate item)
        {
            ClientLocale locale = client.Info.Locale;

            using (RealmPacketOut packet =
                       new RealmPacketOut((PacketId)RealmServerOpCode.SMSG_ITEM_QUERY_SINGLE_RESPONSE, 630))
            {
                packet.Write(item.Id);
                packet.Write((uint)item.Class);
                packet.Write((uint)item.SubClass);
                packet.Write(item.Unk0);
                packet.WriteCString(item.Names.Localize(locale));
                packet.Write((byte)0);
                packet.Write((byte)0);
                packet.Write((byte)0);
                packet.Write(item.DisplayId);
                packet.Write((uint)item.Quality);
                packet.Write((uint)item.Flags);
                packet.Write((uint)item.Flags2);
                packet.Write(item.BuyPrice);
                packet.Write(item.SellPrice);
                packet.Write((uint)item.InventorySlotType);
                packet.Write((uint)item.RequiredClassMask);
                packet.Write((uint)item.RequiredRaceMask);
                packet.Write(item.Level);
                packet.Write(item.RequiredLevel);
                packet.Write(item.RequiredSkill != null ? (int)item.RequiredSkill.Id : 0);
                packet.Write(item.RequiredSkillValue);
                packet.Write(item.RequiredProfession != null ? item.RequiredProfession.Id : 0U);
                packet.Write(item.RequiredPvPRank);
                packet.Write(item.UnknownRank);
                packet.Write(item.RequiredFaction != null ? (int)item.RequiredFaction.Id : 0);
                packet.Write((uint)item.RequiredFactionStanding);
                packet.Write(item.UniqueCount);
                packet.Write(item.MaxAmount);
                packet.Write(item.ContainerSlots);
                packet.Write(item.Mods.Length);
                for (int index = 0; index < item.Mods.Length; ++index)
                {
                    packet.Write((uint)item.Mods[index].Type);
                    packet.Write(item.Mods[index].Value);
                }

                packet.Write(item.ScalingStatDistributionId);
                packet.Write(item.ScalingStatValueFlags);
                for (int index = 0; index < 2; ++index)
                {
                    if (index >= item.Damages.Length)
                    {
                        packet.WriteFloat(0.0f);
                        packet.WriteFloat(0.0f);
                        packet.WriteUInt(0U);
                    }
                    else
                    {
                        DamageInfo damage = item.Damages[index];
                        packet.Write(damage.Minimum);
                        packet.Write(damage.Maximum);
                        packet.Write((uint)damage.School);
                    }
                }

                for (int index = 0; index < 7; ++index)
                {
                    int resistance = item.Resistances[index];
                    packet.Write(resistance);
                }

                packet.Write(item.AttackTime);
                packet.Write((uint)item.ProjectileType);
                packet.Write(item.RangeModifier);
                for (int index = 0; index < 5; ++index)
                {
                    ItemSpell spell;
                    if (index < item.Spells.Length && (spell = item.Spells[index]) != null)
                    {
                        packet.Write((uint)spell.Id);
                        packet.Write((uint)spell.Trigger);
                        packet.Write((uint)Math.Abs(spell.Charges));
                        packet.Write(spell.Cooldown);
                        packet.Write(spell.CategoryId);
                        packet.Write(spell.CategoryCooldown);
                    }
                    else
                    {
                        packet.WriteUInt(0U);
                        packet.WriteUInt(0U);
                        packet.WriteUInt(0U);
                        packet.Write(-1);
                        packet.WriteUInt(0U);
                        packet.Write(-1);
                    }
                }

                packet.Write((uint)item.BondType);
                packet.WriteCString(item.Descriptions.Localize(locale));
                packet.Write(item.PageTextId);
                packet.Write((uint)item.LanguageId);
                packet.Write((uint)item.PageMaterial);
                packet.Write(item.QuestId);
                packet.Write(item.LockId);
                packet.Write((int)item.Material);
                packet.Write((uint)item.SheathType);
                packet.Write(item.RandomPropertiesId);
                packet.Write(item.RandomSuffixId);
                packet.Write(item.BlockValue);
                packet.Write((uint)item.SetId);
                packet.Write(item.MaxDurability);
                packet.Write((uint)item.ZoneId);
                packet.Write((uint)item.MapId);
                packet.Write((uint)item.BagFamily);
                packet.Write((uint)item.ToolCategory);
                for (int index = 0; index < 3; ++index)
                {
                    packet.Write((uint)item.Sockets[index].Color);
                    packet.Write(item.Sockets[index].Content);
                }

                packet.Write(item.SocketBonusEnchantId);
                packet.Write(item.GemPropertiesId);
                packet.Write(item.RequiredDisenchantingLevel);
                packet.Write(item.ArmorModifier);
                packet.Write(item.Duration);
                packet.Write(item.ItemLimitCategoryId);
                packet.Write(item.HolidayId);
                client.Send(packet, false);
            }
        }
Beispiel #39
0
        public RecurringPaymentRequest()
        {
            RecurringPayment oRecurringPayment = new RecurringPayment();

            oRecurringPayment.StoreId  = "120995000";
            oRecurringPayment.Function = Function.install;

            RecurringPaymentInformation oRecurringPaymentInformation = new RecurringPaymentInformation();

            oRecurringPaymentInformation.InstallmentCount           = "12";
            oRecurringPaymentInformation.InstallmentFrequency       = "1";
            oRecurringPaymentInformation.InstallmentPeriod          = RecurringPaymentInformationInstallmentPeriod.month;
            oRecurringPaymentInformation.InstallmentPeriodSpecified = true;
            DateTime dateNow = DateTime.Now.AddDays(5);

            oRecurringPaymentInformation.RecurringStartDate = dateNow.ToString("yyyyMMdd");
            oRecurringPaymentInformation.MaximumFailures    = "3";

            oRecurringPayment.RecurringPaymentInformation = oRecurringPaymentInformation;

            CreditCardData oCreditCardData = new CreditCardData();

            oCreditCardData.Brand            = CreditCardDataBrand.VISA;
            oCreditCardData.BrandSpecified   = true;
            oCreditCardData.ItemsElementName = new ItemsChoiceType[] { ItemsChoiceType.CardNumber, ItemsChoiceType.ExpMonth, ItemsChoiceType.ExpYear, ItemsChoiceType.CardCodeValue };
            oCreditCardData.Items            = new Object[] { "4035874000424977", "12", "18", "977" };

            oRecurringPayment.CreditCardData = oCreditCardData;

            Payment oPayment = new Payment();

            oPayment.SubTotal    = 13;
            oPayment.ChargeTotal = 13;
            oPayment.Currency    = "978";

            oRecurringPayment.Payment = oPayment;

            Billing oBilling = new Billing();

            oBilling.Name     = "Name";
            oBilling.Address1 = "Address";
            oBilling.City     = "City";
            oBilling.State    = "State";
            oBilling.Zip      = "Zip";
            oBilling.Country  = "Country";

            oRecurringPayment.Billing = oBilling;

            ClientLocale oClientLocale = new ClientLocale();

            oClientLocale.Country  = "UK";
            oClientLocale.Language = "en";

            WSIPGClient.WebReference.Action oAction;
            oAction              = new WSIPGClient.WebReference.Action();
            oAction.Item         = oRecurringPayment;
            oAction.ClientLocale = oClientLocale;

            RecurringPaymentActionRequest      = new IPGApiActionRequest();
            RecurringPaymentActionRequest.Item = oAction;
        }
Beispiel #40
0
        private static void Main(string[] args)
        {
            SetUpConsole();

            var files = args.ToList();

            if (files.Count == 0)
            {
                PrintUsage();
                return;
            }

            // config options are handled in Misc.Settings
            Utilities.RemoveConfigOptions(ref files);

            if (!Utilities.GetFiles(ref files))
            {
                EndPrompt();
                return;
            }

            Thread.CurrentThread.CurrentCulture     = CultureInfo.InvariantCulture;
            CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture;

            if (Settings.UseDBC)
            {
                var startTime = DateTime.Now;

                DBC.DBC.Load();

                var span = DateTime.Now.Subtract(startTime);
                Trace.WriteLine($"DBC loaded in { span.ToFormattedString() }.");
            }

            // Disable DB when we don't need its data (dumping to a binary file)
            if (!Settings.DumpFormatWithSQL())
            {
                SQLConnector.Enabled = false;
                SSHTunnel.Enabled    = false;
            }
            else
            {
                Filters.Initialize();
            }

            SQLConnector.ReadDB();

            var count = 0;

            foreach (var file in files)
            {
                SessionHandler.ZStreams.Clear();
                if (Settings.ClientBuild != Enums.ClientVersionBuild.Zero)
                {
                    ClientVersion.SetVersion(Settings.ClientBuild);
                }

                ClientLocale.SetLocale(Settings.ClientLocale.ToString());

                try
                {
                    var sf = new SniffFile(file, Settings.DumpFormat, Tuple.Create(++count, files.Count));
                    sf.ProcessFile();
                }
                catch (IOException ex)
                {
                    Console.WriteLine($"Can't process {file}. Skipping. Message: {ex.Message}");
                }
            }

            if (!string.IsNullOrWhiteSpace(Settings.SQLFileName) && Settings.DumpFormatWithSQL())
            {
                Builder.DumpSQL("Dumping global sql", Settings.SQLFileName, SniffFile.GetHeader("multi"));
            }

            SQLConnector.Disconnect();
            SSHTunnel.Disconnect();

            if (Settings.LogErrors)
            {
                Logger.WriteErrors();
            }

            Trace.Listeners.Remove("ConsoleMirror");

            EndPrompt();
        }